create or replace for tables and schemas

From: "Marcelo de Moraes Serpa" <celoserpa(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: create or replace for tables and schemas
Date: 2007-08-27 11:24:51
Message-ID: 1e5bcefd0708270424g1ed4e7cuef841b282340e477@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

For some weid reason, I can't use a stored function nor return data from
sql, just send sql to the database, that's my constraint for now and I have
to deal with it.

I have to create a schema and just after a table in this schema. I can't
check for the existence of the table nor the schema. If the sql code to
create the table and the schema is ran when the schema and or the table
exist, a sql excepetion is thrown and my application halts.

With this in mind, I'd like to know if there is something like CREATE OR
REPLACE for tables and schemas so that if the object already exists, it will
just replace it.

For those curious, my company uses an application generator called GeneXus,
it has a "sql" "command" which allows you to send direct sql sentences to
the database **as long as** they don't return anything. Oh life.

Anyway, thanks in advance,

Marcelo.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-08-27 11:39:17 Re: create or replace for tables and schemas
Previous Message Andrus 2007-08-27 11:00:02 Removing pollution from log files