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

add quoting to postgis raster driver #837

Merged
merged 3 commits into from
Aug 26, 2018

Conversation

jef-n
Copy link
Contributor

@jef-n jef-n commented Aug 9, 2018

What does this PR do?

add quoting to the postgisraster driver - untested, here to trigger tests…

What are related issues/pull requests?

https://issues.qgis.org/issues/19583

Tasklist

  • ADD YOUR TASKS HERE
  • Add test case(s)
  • Review
  • Adjust for comments
  • All CI builds and checks have passed

Environment

Provide environment details, if relevant:

  • OS:
  • Compiler:

This reverts commit 9ec6971.

Revert "Disable NAS tests as they are broken for now (refs OSGeo#720)"

This reverts commit 5a4d3f4.
@@ -342,9 +342,6 @@ def ogr_nas_5():
ogr_nas_4,
ogr_nas_5]

# NAS tests disabled for now
gdaltest_list = []
Copy link
Member

@rouault rouault Aug 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is unrelated to the commit

@@ -74,7 +74,11 @@ static int OGRNASDriverIdentify( GDALOpenInfo* poOpenInfo )
if( strstr(szPtr,"opengis.net/gml") == nullptr )
return FALSE;

char **papszIndicators = CSLTokenizeStringComplex(CPLGetConfigOption("NAS_INDICATOR", ""), ";", 0, 0 );
char **papszIndicators = CSLTokenizeStringComplex(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change


<p>The former default of "NAS-Operationen;AAA-Fachschema;aaa.xsd;aaa-suite" was
removed and has now to be explicitly specified to enable detection.</p>
separated strings listed in the option <b>NAS_INDICATOR</b> (which defaults to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change

@rouault
Copy link
Member

rouault commented Aug 9, 2018

oh, looking closer, I didn't see there was a separate commit for the change in NAS, so this is probably OK (although a bit confusing to be conflated in this PR)

@jef-n
Copy link
Contributor Author

jef-n commented Aug 10, 2018

Yes sorry. The NAS change is just one pending in my branch, that just reverts the recent changes back to how it was before (OGR_SKIP=NAS should be ok after all). With the PR I actually only wanted to trigger test - which miserably failed - although the failures seem unrelated to the changes.

@rouault
Copy link
Member

rouault commented Aug 10, 2018

I've restarted the failed jobs

CPLString osColumnI(CPLQuotedSQLIdentifier(pszColumn));
CPLString osSrcColumnI(CPLQuotedSQLIdentifier(poSrcDS->pszSchema));
CPLString osSrcSchemaI(CPLQuotedSQLIdentifier(poSrcDS->pszTable));
CPLString osSrcTableI;(CPLQuotedSQLIdentifier(poSrcDS->pszColumn));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extraneous ; between osSrcTableI and CPLQuoted...

@@ -3526,7 +3553,7 @@ PostGISRasterDataset::CreateCopy( CPL_UNUSED const char * pszFilename,

osCommand.Printf("create index %s_%s_gist ON %s.%s USING gist "
"(st_convexhull(%s));", pszTable, pszColumn,
pszSchema, pszTable, pszColumn);
osSchemaI.c_str(), osTableI.c_str(), osColumnI.c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the index name %s_%s_gist itself should be quoted

@@ -2104,12 +2120,12 @@ const char * pszValidConnectionString)
papszSubdatasets[2 * i] =
CPLStrdup(CPLSPrintf("SUBDATASET_%d_NAME=PG:%s schema=%s table=%s column=%s "
"where='%s = %s'", i+ 1, pszValidConnectionString,
pszSchema, pszTable, pszColumn, pszPrimaryKeyName,
pszSchema, pszTable, pszColumn, osPrimaryKeyNameI.c_str(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pszSchema, pszTable, pszColumn should probably be quoted too, but I'm not sure the Open() parsing code is ready for it. Actually looking at autotest/gdrivers/postgisraster.py , it seems ready for single quoting, at least for table name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work - Looks like what helped in qgis/QGIS@f4d08eb926

@rouault
Copy link
Member

rouault commented Aug 11, 2018

Looks good to me. I let you merge

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.

2 participants