[postgis-users] PSQL command to drop table from a databae

Kevin Neufeld kneufeld at refractions.net
Sun Mar 28 09:25:12 PDT 2010


Since you are using a non-standard way of naming your table (starting 
with number), as Oliver was explaining, you need to double quote your 
table name.

$ set mytab=\"123foo\"

$ echo $mytab
"foo"

$ psql -c "CREATE TABLE $mytab( a int ) " postgis
CREATE TABLE

$ psql -c "\dt" postgis
               List of relations
  Schema |       Name       | Type  |  Owner
--------+------------------+-------+----------
  public | 123foo           | table | kneufeld
  public | geometry_columns | table | kneufeld
  public | spatial_ref_sys  | table | kneufeld
(3 rows)

$ psql -c "DROP TABLE $mytab" postgis
DROP TABLE

-- Kevin

On 3/28/2010 8:35 AM, Shreerang Patwardhan wrote:
> Hi Ollvier,
>    I was just writing to you about your previous mail. Well, th e DROP 
> TABLE command is not working at my end. I have used double quotes 
> also. Can you guess what could the problem be? I am trying to use that 
> command in a shell script and it is not working. I have also tried it 
> on the terminal and still the result is the same....ERROR!!!.....
> Need help!!!
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100328/8a173914/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 592 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100328/8a173914/attachment.png>


More information about the postgis-users mailing list