Skip to content

Read the SQL declarations without their comments - #150

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/sql-without-comments
Sep 30, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/sql-without-comments

Conversation

@estebanzimanyi

@estebanzimanyi estebanzimanyi commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

The SQL signatures are read from the CREATE FUNCTION statements with every
-- and /* */ comment blanked first, newlines kept and string literals stepped
over, as parser/temporaltypes.py reads C. A statement commented out is no
declaration: the extension does not create it, so no binding may register
it. A commented line inside a declaration is no part of it:
asMVTGeom(tgeompoint, ...) keeps an older -- RETURNS tgeompoint above its
RETURNS geom_times, which left the statement without a return type.

Measured. Over MobilityDB a362004728 the catalog drops 6 signatures the
extension does not create, each commented out in its .in.sql:
stops(tgeometry, float, interval), stops(tgeography, float, interval),
stops(tjsonb, interval), tsample(trgeometry, interval, timestamptz),
bearing(tgeogpoint, tgeogpoint) and asMVTGeom(tgeometry, ...), and
asMVTGeom(tgeompoint, ...) returns geom_times, so tpoint_as_mvtgeom states
its sqlReturnType. The catalog is otherwise identical.

Witness. tests/test_sql_comments.py blanks line and nested block comments,
keeps a comment opener inside a literal, registers nothing for a declaration
commented out, and reads the return type and the arguments of a declaration
carrying commented lines.

@estebanzimanyi
estebanzimanyi force-pushed the catalog/sql-without-comments branch from f1587a9 to ca4ef2f Compare September 30, 2026 13:05
The SQL signatures are read from the CREATE FUNCTION statements with every
-- and /* */ comment blanked first, newlines kept and string literals stepped
over, as parser/temporaltypes.py reads C. A statement commented out is no
declaration: the extension does not create it, so no binding may register
it. A commented line inside a declaration is no part of it:
asMVTGeom(tgeompoint, ...) keeps an older -- RETURNS tgeompoint above its
RETURNS geom_times, which left the statement without a return type.

Measured. Over MobilityDB a362004728 the catalog drops 6 signatures the
extension does not create, each commented out in its .in.sql:
stops(tgeometry, float, interval), stops(tgeography, float, interval),
stops(tjsonb, interval), tsample(trgeometry, interval, timestamptz),
bearing(tgeogpoint, tgeogpoint) and asMVTGeom(tgeometry, ...), and
asMVTGeom(tgeompoint, ...) returns geom_times, so tpoint_as_mvtgeom states
its sqlReturnType. The catalog is otherwise identical.

Witness. tests/test_sql_comments.py blanks line and nested block comments,
keeps a comment opener inside a literal, registers nothing for a declaration
commented out, and reads the return type and the arguments of a declaration
carrying commented lines.
@estebanzimanyi
estebanzimanyi force-pushed the catalog/sql-without-comments branch from ca4ef2f to 3fe93a9 Compare September 30, 2026 13:14
@estebanzimanyi
estebanzimanyi merged commit 8dddf59 into MobilityDB:master Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant