From d71a3ffa1350d3539a0f3e70ea1a67c84b61b20c Mon Sep 17 00:00:00 2001 From: rrindels Date: Wed, 1 May 2024 00:44:20 -0500 Subject: [PATCH] Update SQL.js to quote "V" field in getBlobSizefn for pg --- engines/SQL.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/engines/SQL.js b/engines/SQL.js index 4ec2459..f16f45e 100644 --- a/engines/SQL.js +++ b/engines/SQL.js @@ -86,19 +86,10 @@ module.exports = class SQLEngine extends Component { let CREATED = 'created' let UPDATED = 'updated' - /*Postgres requires "length" instead of len for bytea fields. Noticed failures during head operations. - The other option would be to create a postgres function called len() on setup create which wraps the length() operation. - CREATE OR REPLACE FUNCTION len(byteafield bytea) - RETURNS int AS - $$ - BEGIN - RETURN length(byteafield); - END; - $$ - LANGUAGE plpgsql IMMUTABLE; - */ + // Postgres requires quoted "V" field since the schema was created with the quoted "V" field. + T if (this.client === 'pg'){ - this.getBlobSizefn = "length(\"V\")" + this.getBlobSizefn = 'length("V")' } if (this.client === 'mssql') {