Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix postgis_proc_set_search_path.pl to handle complex defaults quotes #515

Closed
wants to merge 1 commit into from

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Nov 14, 2019

As discovered in #514,
an argument default with parenthesis instide the string breaks
regression sql generator (evil regexes). Fixed with more evil regexes:
now it has a special handling for a '...' -- ignoring all chars inside.

Escaping is not handled (doesn't seem like PostGIS has any of them)

Example:

The script can now convert this:

CREATE OR REPLACE FUNCTION ST_TileEnvelope(zoom integer, x integer, y integer, margin float8, bounds geometry DEFAULT 'SRID=3857;LINESTRING(-20037508.342789 -20037508.342789, 20037508.342789 20037508.342789)'::geometry)

into this:

ST_TileEnvelope(zoom integer, x integer, y integer, bounds geometry)

As discovered in postgis#514,
an argument default with parenthesis instide the string breaks
regression sql generator (evil regexes).  Fixed with more evil regexes:
now it has a special handling for a '...' -- ignoring all chars inside.

Escaping is not handled (doesn't seem like PostGIS has any of them)

Example:

The script can now convert this:

CREATE OR REPLACE FUNCTION ST_TileEnvelope(zoom integer, x integer, y integer, margin float8, bounds geometry DEFAULT 'SRID=3857;LINESTRING(-20037508.342789 -20037508.342789, 20037508.342789 20037508.342789)'::geometry)

into this:

ST_TileEnvelope(zoom integer, x integer, y integer, bounds geometry)
@robe2
Copy link
Member

robe2 commented Nov 15, 2019

Hmm we were thinking of getting rid of postgis_proc_set_search_path.pl. It shouldn't be used for anything anymore -- you see it used somewhere. That was put in 2.2/2.3 days before we realized setting search path on functions kills performance.

@nyurik
Copy link
Contributor Author

nyurik commented Nov 15, 2019

Regina, I'm all for making the build process more streamlined, but this is orthogonal to the bug at hand. At the moment, any change to ST_TileEnvelope() signature would cause this bug to surface - that's why #514 wouldn't build until I fixed this issue and rebased on it.

@Algunenano
Copy link
Member

Hmm we were thinking of getting rid of postgis_proc_set_search_path.pl. It shouldn't be used for anything anymore -- you see it used somewhere. That was put in 2.2/2.3 days before we realized setting search path on functions kills performance

I've created an issue to drop it: https://trac.osgeo.org/postgis/ticket/4579 I'll try to do it during the day so this PR will no longer be necessary.

@Algunenano
Copy link
Member

postgis_proc_set_search_path.pl removed

@Algunenano Algunenano closed this Nov 15, 2019
@nyurik nyurik deleted the fix-defaults branch November 16, 2019 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants