PostreSQL SQL for MySQL SQL

From: Chuck Esterbrook <echuck(at)mindspring(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: PostreSQL SQL for MySQL SQL
Date: 2001-02-06 16:41:38
Message-ID: 5.0.2.1.0.20010206112901.02181190@mail.mindspring.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm fairly new to PostreSQL, coming from MySQL. My Python application
generates these MySQL commands:

drop database if exists Foo;
create database Foo;
use Foo;

Using the PostgreSQL online docs, my closest translation is:

drop database Foo;
create database Foo;

What I'm missing is:
* "if exists" for the drop, in order to avoid an error the very first time
this program runs
* the "use Foo;"

Can I do these things in PostreSQL from SQL (e.g., not from the command line)?

-Chuck

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-02-06 16:49:11 Re: PostreSQL SQL for MySQL SQL
Previous Message Tom Lane 2001-02-06 16:41:06 Re: Number of open files