Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need support for BYTEA type for data comparison... #59

Open
zxli opened this issue Apr 3, 2024 · 1 comment
Open

Need support for BYTEA type for data comparison... #59

zxli opened this issue Apr 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@zxli
Copy link

zxli commented Apr 3, 2024

In sqlScriptGenerator.js, BYTEA type will fall back to default user type and result in the error "value.replace is not a function".

			case "U": {
				//USER TYPE
				switch (dataTypeName) {
					case "jsonb":
					case "json":
						return `'${JSON.stringify(value).replace(/'/g, "''")}'`;
					case "bytea":
						console.log(value.toString('hex'));
						return `'\\x${value.toString('hex')}'`;
					default:
						//like XML, UUID, GEOMETRY, etc.
						return `'${value.replace(/'/g, "''")}'`;
				}
``

`It could be fixed by a change like this.
		case "U": {
			//USER TYPE
			switch (dataTypeName) {
				case "jsonb":
				case "json":
					return `'${JSON.stringify(value).replace(/'/g, "''")}'`;
				case "bytea":
					return `'\\x${value.toString('hex')}'`;
@zxli zxli changed the title Need support BYTEA type for data comparison... Need support for BYTEA type for data comparison... Apr 3, 2024
@michaelsogos michaelsogos self-assigned this Jun 6, 2024
@michaelsogos michaelsogos added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jun 6, 2024
@michaelsogos
Copy link
Owner

Hi @zxli ,

Sure I missed something because the default case must remain, but in the code that you mentioned the case "bytea" is there, so it should not land in the default case.

Let me debug it and I will come back to you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do
Development

No branches or pull requests

2 participants