[postgis-users] Removed double quotes from column and table names

Lee Hachadoorian Lee.Hachadoorian+L at gmail.com
Mon Mar 19 11:10:28 PDT 2012


This option is not available via SPIT, but ogr2ogr does allow it as a layer
creation option:

"LAUNDER: This may be "YES" to force new fields created on this layer to
have their field names "laundered" into a form more compatible with
PostgreSQL. This converts to lower case and converts some special
characters like "-" and "#" to "_". If "NO" exact names are preserved. The
default value is "YES". If enabled the table (layer) name will also be
laundered." (http://www.gdal.org/ogr/drv_pg.html)

Also shp2pgsql defaults to forcing lower case names (the correct choice,
IMHO), but has an option to specify preserving case.

Best,
--Lee


On Mon, Mar 19, 2012 at 6:58 AM, Simon Greener
<simon at spatialdbadvisor.com>wrote:

> Birgit,
>
> I realise that I can do this manually. I was looking for a method for doing
> this at the point of loading the shapefile into PostGIS using QGIS. I will
> have a look at ogr2ogr to see if that helps.
>
> Thanks
> regards
> Simon
>
> On Mon, 19 Mar 2012 21:00:27 +1100, Birgit Laggner <
> birgit.laggner at vti.bund.de> wrote:
>
>  Hi Simon,
>>
>> I would think RENAME would do what you want:
>>
>> ALTER TABLE schema."TableName" RENAME TO tablename;
>>
>> ALTER TABLE schema.tablename RENAME COLUMN "ColumnName" TO columnname;
>>
>> Hope that helps,
>>
>> Birgit.
>>
>>
>> Am 19.03.2012 06:03, schrieb Simon Greener:
>>
>>> Is there any way to remove the double quotes created around a table or
>>> its column names?
>>> My names do NOT include spaces but do include mixed case. I wish to
>>> remove the quotes and
>>> lower case all names.
>>> How can this be done?
>>> Note: the tables were loaded by QGIS into PostgreSQL. In the DBF file
>>> the names are mixed case.
>>> I can see nothing in the PostGIS/QGIS plugin SPIT that allows me to
>>> tell it to lower case all names.
>>> S
>>>
>> ______________________________**_________________
>> postgis-users mailing list
>> postgis-users at postgis.**refractions.net<postgis-users at postgis.refractions.net>
>> http://postgis.refractions.**net/mailman/listinfo/postgis-**users<http://postgis.refractions.net/mailman/listinfo/postgis-users>
>>
>>
>
> --
> Holder of "2011 Oracle Spatial Excellence Award for Education and
> Research."
> SpatialDB Advice and Design, Solutions Architecture and Programming,
> Oracle Database 10g Administrator Certified Associate; Oracle Database 10g
> SQL Certified Professional
> Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME,
> Radius Topology and Studio Specialist.
> 39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
> Website: www.spatialdbadvisor.com
>  Email: simon at spatialdbadvisor.com
>  Voice: +61 362 396397
> Mobile: +61 418 396391
> Skype: sggreener
> Longitude: 147.20515 (147° 12' 18" E)
> Latitude: -43.01530 (43° 00' 55" S)
> GeoHash: r22em9r98wg
> NAC:W80CK 7SWP3
> ______________________________**_________________
> postgis-users mailing list
> postgis-users at postgis.**refractions.net<postgis-users at postgis.refractions.net>
> http://postgis.refractions.**net/mailman/listinfo/postgis-**users<http://postgis.refractions.net/mailman/listinfo/postgis-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120319/69f50b21/attachment.html>


More information about the postgis-users mailing list