Skip to content

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

@zxli

Description

@zxli

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')}'`;

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions