Opened 5 years ago

Closed 5 years ago

Last modified 2 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 Changed 5 years ago by robe

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 Changed 5 years ago by robe

Milestone: PostGIS 2.1.8PostGIS Future

comment:3 Changed 5 years ago by Bborie Park

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 Changed 5 years ago by tinproject

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 Changed 2 years ago by robe

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.