Re: Create table if not exists ... how ??

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Create table if not exists ... how ??
Дата
Msg-id 4C448442.9090103@joeconway.com
обсуждение исходный текст
Ответ на Create table if not exists ... how ??  (Jennifer Trey <jennifer.trey@gmail.com>)
Ответы Re: Create table if not exists ... how ??  (Jennifer Trey <jennifer.trey@gmail.com>)
Re: Create table if not exists ... how ??  ("Igor Neyman" <ineyman@perceptron.com>)
Список pgsql-general
On 07/19/2010 09:33 AM, Jennifer Trey wrote:
> I can't figure out the correct syntax...
>
> I have this, but it just keeps complaining about the IF
>
> IF NOT EXISTS (SELECT table_name FROM information_schema.tables where
> table_name = 'post_codes')
>
> THEN
>
> CREATE TABLE post_codes

Probably better to do:

DROP TABLE IF EXISTS post_codes;
CREATE TABLE post_codes(...);

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

HTH,

Joe

--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support


Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: tuanhoanganh
Дата:
Сообщение: Re: Rescue data after power off
Следующее
От: "Duncavage, Daniel P. (JSC-OD211)"
Дата:
Сообщение: Re: NASA needs Postgres - Nagios help