Skip to content

Commit

Permalink
Update SQL.js to quote "V" field in getBlobSizefn for pg
Browse files Browse the repository at this point in the history
  • Loading branch information
rrindels authored May 1, 2024
1 parent 3cf452e commit d71a3ff
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions engines/SQL.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit d71a3ff

Please sign in to comment.