Bug
functions.create / regenerating a function via functions.update emits unquoted SET values:
SET statement_timeout TO 5s
That is invalid PostgreSQL (trailing junk after numeric literal). Values that look like identifiers (e.g. search_path TO hooks, auth) happen to work but fold case and cannot carry commas inside a single GUC value safely.
Role config creation already quotes via literal() / list-item quoting; function config_params does not.
Repro
await pgMeta.functions.create({
name: 'test_timeout_func',
schema: 'public',
args: [],
definition: 'select 1',
return_type: 'integer',
language: 'sql',
behavior: 'VOLATILE',
security_definer: false,
config_params: { statement_timeout: '5s' },
})
// → SQL error near 5s
Also breaks body updates for any existing function that already has statement_timeout (or similar) in config_params, because update regenerates CREATE OR REPLACE from those values.
Expected
SET statement_timeout TO '5s'
SET search_path TO 'hooks', 'auth'
Bug
functions.create/ regenerating a function viafunctions.updateemits unquotedSETvalues:SET statement_timeout TO 5sThat is invalid PostgreSQL (
trailing junk after numeric literal). Values that look like identifiers (e.g.search_path TO hooks, auth) happen to work but fold case and cannot carry commas inside a single GUC value safely.Role config creation already quotes via
literal()/ list-item quoting; functionconfig_paramsdoes not.Repro
Also breaks body updates for any existing function that already has
statement_timeout(or similar) inconfig_params, because update regeneratesCREATE OR REPLACEfrom those values.Expected