Opened 17 years ago

Last modified 17 years ago

#1431 closed defect (fixed)

Bug, PostgreSQL driver -lco LAUNDER=YES

Reported by: ruckc@… Owned by: Mateusz Łoskot
Priority: highest Milestone:
Component: OGR_SF Version: 1.4.0
Severity: minor Keywords:
Cc:

Description (last modified by Mateusz Łoskot)

In my opinion LAUNDER=YES should also launder the table names, or there should be a separate option to do so. According to #524, LAUNDER should do table and column names, but according to http://ogr.maptools.org/drv_pg.html, its only field names.

Change History (8)

comment:1 by warmerdam, 17 years ago

The table name is in fact also laundered.  I have updated drv_pg.html 
accordingly.

comment:2 by ruckc@…, 17 years ago

Then i am updating the bug to because its not working in GDAL-1.4.0 that i just installed.  Here is my shell script that was executed to do this (tiger files are contained in folders named after each state): 

STATES="AK AL AR AS AZ ... WV WY"

export PG_USE_COPY=YES
for STATE in $STATES; do
 echo $STATE
 ogr2ogr -update -append -lco LAUNDER=YES -lco DIM=2 -lco GEOMETRY_NAME=the_geom -f "PostgreSQL" -t_srs epsg:4326 PG:"dbname=tiger2006fe user=myuser host=localhost" $STATE
done

comment:3 by warmerdam, 17 years ago

Curtis, 

On reviewing the code I see that the folks who implemented schema support
broke this, apparently missing the point of some other code.  I'll fix it 
for 1.4.1. 

comment:4 by warmerdam, 17 years ago

Mateusz, 

Could you address this?  I *may* have fixed it and forgot to update this report.
The fix should be in 1.4 branch as well as trunk. 

comment:5 by Mateusz Łoskot, 17 years ago

I partially fixed the laundering problem.
I mean partially, as it launders or not launders depending on give parameters. In previous version, the table name was not laundered at all because of small bug.

Here is the first (partial) fix:
http://trac.osgeo.org/gdal/changeset/10944

I want to stress that the logic of turning laundering on/off in the PG driver "looks strange", and I reported it in the log message.
Currently, the laundering is turned on by default, regardless a user provides pr not the LAUNDER=YES option.

Following two commands are equivalents regarding laundering, all names will be laundered in both cases:

ogr2ogr -update -append -lco GEOMETRY_NAME=the_geom -f PostgreSQL PG:'dbname=test' POINT.shp

ogr2ogr -update -append -lco LAUNDER=YES -lco GEOMETRY_NAME=the_geom -f PostgreSQL PG:'dbname=test' POINT.shp

Currently, in order to turn laundering off, the command should look as follows:

ogr2ogr -update -append -lco LAUNDER=NO -lco GEOMETRY_NAME=the_geom -f PostgreSQL PG:'dbname=test' POINT.shp


I believe, the PG driver should turn off laundering by default and
only launder names when a user explicitly asks for it:

1) Do NOT launder:

ogr2ogr -update -append -lco GEOMETRY_NAME=the_geom -f PostgreSQL PG:'dbname=test' POINT.shp

2) Do launder:

ogr2ogr -update -append -lco LAUNDER=YES -lco GEOMETRY_NAME=the_geom -f PostgreSQL PG:'dbname=test' POINT.shp


Please, confirm if my understanding is correct and I will remove laundering by default (I live the bug open for now). 

comment:6 by warmerdam, 17 years ago

Mateusz,

It is the intended situation that laundering should be on by default. 

At one time it was off by default, and it was a large source of problems, 
so after some consideration this option was made on by default. 

I don't see any reason to flip-flop again on this. 

comment:7 by Mateusz Łoskot, 17 years ago

Frank,

OK, it's clear to me the laundering is ON by default.
So, I think I can close this bug as fixed.

Curtis,

I'd appreciate if you could confirm if everything works for you too.

comment:8 by Mateusz Łoskot, 17 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.