Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#3147 closed defect (invalid)

[raster] raster2pgsql should check that the resulting table name it's a valid SQL name.

Reported by: tinproject Owned by: Bborie Park
Priority: low Milestone: PostGIS Fund Me
Component: raster Version: 2.1.x
Keywords: raster2pgsql Cc:

Description

For example, executing:

raster2pgsql 0457h30.tif | psql -d "db" -h "host" -U "user" -W

ends with a table named 0457h30 on the database. That name it's not a valid PostgreSQL table name so a "SELECT * FROM 0457h30;" will fail, also a "DROP TABLE 0457h30;" fails too.

Tested with raster2pgsql RELEASE: 2.1.7 GDAL_VERSION=111 (r13414) on Windows.

Change History (5)

comment:1 by robe, 9 years ago

tinproject,

is this error being generated from within raster2pgsql, or just when you manually run those statements.

Normally you pass the table name into raster2pgsql for what you want the new table.

and

if you didn't you should be doing:

SELECT * FROM "0457j30";

since there is nothing technically wrong with a table name 0457j30.

For things like that, not sure I agree that raster2pgsql should try to come up with a name that doesn't require quoting by default. Perhaps as an additional switch option, but I would expect some people might rely on the current behavior, so defintely not something we can put in a micro unless it's actually breaking now in raster2.pgsql.

comment:2 by robe, 9 years ago

Milestone: PostGIS 2.1.8PostGIS Future

comment:3 by Bborie Park, 9 years ago

Resolution: invalid
Status: newclosed

Given that the table name is valid (the difference between a table called test and Test), I'm calling this invalid.

comment:4 by tinproject, 9 years ago

Yes, I forgot about the quotes. I reply here for reference if someone it's facing the same issue:

This error was arise originally in QGIS, importing a PostGIS Raster, as a not useful information error. After long time trying with psql I notice that the problem was the table name. So I suppouse that was a problem with raster2psql, but the real problem it's that QGIS is not quoting the identifiers correctly.

comment:5 by robe, 7 years ago

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.