Re: drop table if exists mytable;

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "Anton Melser" <melser(dot)anton(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: drop table if exists mytable;
Date: 2007-02-10 15:22:28
Message-ID: 65937bea0702100722s4698a95nf58c42816da6a5a6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am not sure if I understood the problem correctly!!!

Can you not use the standard command "DROP TABLE IF EXISTS table1" that PG
provides?

http://www.postgresql.org/docs/8.2/interactive/sql-droptable.html

Or is it that you are on a version of PG where "IF EXISTS" syntax is not
available?

Regards,

--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | yahoo }.com

On 2/10/07, Anton Melser <melser(dot)anton(at)gmail(dot)com> wrote:
>
> Hi,
> I need to do a "drop table if exists" type thing. I realise I can
> easily look in pg_tables, but for testing (if), don't I need to use a
> procedural language? In which case, I will need to install it if it
> doesn't exist - but I don't know how to test to see whether a language
> exists without using a language!
> Am I missing something simple here? Is there no way to do this outside
> of a function?
> Cheers
> Antoine
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2007-02-10 15:33:11 Re: drop table if exists mytable;
Previous Message Anton Melser 2007-02-10 14:44:15 drop table if exists mytable;