Thread: Replacing Tables

Replacing Tables

From
Greg Lindstrom
Date:
Greetings-
Is there a postgres equivalent to the  CREATE OR REPLACE TABLE ....
command in MySQL?  I've looked trough the docs and can't find it.

Also, I have been using plpgsql to generate stored procedures; are there
tutorials or manuals available?  Again, I've been looking for books on
Amazon, O'Reilly, and Sams but can't find much on plpgsql.  I have a
library of about 40 routines which generate XML from my database  and
would like to know more about the language.

Thanks for your help,
--greg

--
Greg Lindstrom               501 975.4859 (office)
Programmer                   501 219-4455 (fax)
NovaSys Health               greg.lindstrom@novasyshealth.com
Little Rock, Arkansas

"We are the music makers, and we are the dreamers of dreams."  W.W.

Confidentiality Notice
----------------------
This email and any attachments to it are privileged and confidential and are intended solely for use of the individual
orentity to which they are addressed. If the reader of this message is not the intended recipient, any use,
distribution,or copying of this communication, or disclosure of all or any part of its content to any other person, is
strictlyprohibited. If you have received this communication in error, please notify the sender by replying to this
messageand destroy this message and delete any copies held in your electronic files. Thank you. 


Re: Replacing Tables

From
Sean Davis
Date:


On 1/3/06 9:35 AM, "Greg Lindstrom" <greg.lindstrom@novasyshealth.com>
wrote:

> Greetings-
> Is there a postgres equivalent to the  CREATE OR REPLACE TABLE ....
> command in MySQL?  I've looked trough the docs and can't find it.

Nope.  The usual answer given is to just do the DROP TABLE as usual and know
that it will fail if the table doesn't exist--no big deal as long as this
occurs in its own transaction.  Then, CREATE the table as usual.

> Also, I have been using plpgsql to generate stored procedures; are there
> tutorials or manuals available?  Again, I've been looking for books on
> Amazon, O'Reilly, and Sams but can't find much on plpgsql.  I have a
> library of about 40 routines which generate XML from my database  and
> would like to know more about the language.

Have you looked at the postgres documentation?  Is there a specific aspect
of the language that you would like more information on?

Sean