You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR: syntax error at or near "." at character 115
STATEMENT: CREATE OR REPLACE FUNCTION null_count(
argument json
) RETURNS int LANGUAGE sql IMMUTABLE AS 'SELECT @extschema@.null_count($1::jsonb)';
psql:/docker-entrypoint-initdb.d/count_nulls.sql:19: ERROR: syntax error at or near "."
LINE 3: ... int LANGUAGE sql IMMUTABLE AS 'SELECT @extschema@.null_coun..
This still reproduces on current master (b52d136), PostgreSQL 17, but only when sql/count_nulls.sql is executed directly (e.g. psql -f sql/count_nulls.sql, or dropping it into /docker-entrypoint-initdb.d/) rather than installed with CREATE EXTENSION count_nulls.
$ psql -d issue2_test -f sql/count_nulls.sql
psql:sql/count_nulls.sql:17: ERROR: syntax error at or near "."
LINE 3: ... int LANGUAGE sql IMMUTABLE AS 'SELECT @extschema@.null_coun...
psql:sql/count_nulls.sql:41: ERROR: syntax error at or near "."
LINE 17: IF @extschema@.null_count( row_to_json(NEW) ) <> TG_ARGV[0...
psql:sql/count_nulls.sql:60: ERROR: syntax error at or near "."
psql:sql/count_nulls.sql:84: ERROR: syntax error at or near "."
Cause: @extschema@ is a placeholder that PostgreSQL substitutes only while CREATE EXTENSION runs an extension script. Any other way of loading the file leaves the literal @extschema@ in the SQL, and the parser rejects it at the following .. That affects null_count(json), not_null_count(json), and the bodies of the two trigger functions.
Nothing in the history has changed this. The repo's own test suite always installs via CREATE EXTENSION, so it doesn't exercise the direct-load path.
Workaround: install with make install and then CREATE EXTENSION count_nulls; (in Docker, run that from an init script instead of loading the .sql file).
Open question for a fix: either document that the sql/*.sql files are extension scripts and not standalone scripts, or make a direct load fail with a clearer message.
Activity
jnasbyupgrade commentedon Sep 29, 2026
This still reproduces on current
master(b52d136), PostgreSQL 17, but only whensql/count_nulls.sqlis executed directly (e.g.psql -f sql/count_nulls.sql, or dropping it into/docker-entrypoint-initdb.d/) rather than installed withCREATE EXTENSION count_nulls.Cause:
@extschema@is a placeholder that PostgreSQL substitutes only whileCREATE EXTENSIONruns an extension script. Any other way of loading the file leaves the literal@extschema@in the SQL, and the parser rejects it at the following.. That affectsnull_count(json),not_null_count(json), and the bodies of the two trigger functions.Nothing in the history has changed this. The repo's own test suite always installs via
CREATE EXTENSION, so it doesn't exercise the direct-load path.Workaround: install with
make installand thenCREATE EXTENSION count_nulls;(in Docker, run that from an init script instead of loading the.sqlfile).Open question for a fix: either document that the
sql/*.sqlfiles are extension scripts and not standalone scripts, or make a direct load fail with a clearer message.🤖 Generated with Claude Code