Re: PostreSQL SQL for MySQL SQL

Поиск
Список
Период
Сортировка
Искать
От
Mitch Vincent
Тема
Re: PostreSQL SQL for MySQL SQL
Дата
Msg-id
00f201c0905c$bb7a4f80$0200000a@windows
Список
Дерево обсуждения
PostreSQL SQL for MySQL SQL Chuck Esterbrook <echuck@mindspring.com>
Re: PostreSQL SQL for MySQL SQL Bruce Momjian <pgman@candle.pha.pa.us>
> 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;

You supply the database name on connect.. I don't *think* you can change
databases after you've connected but I could be very wrong (if you can, I'd
sure like to know!)

> 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)?

Not sure on these...

-Mitch

В списке pgsql-general по дате отправления
От: Chuck Esterbrook
Дата:
Сообщение: PostreSQL SQL for MySQL SQL
От: Tressens Lionel
Дата:
Сообщение: permissions on databases
FAQ