Re: add column if doesn't exist

Поиск
Список
Период
Сортировка
От Brandon Metcalf
Тема Re: add column if doesn't exist
Дата
Msg-id Pine.LNX.4.58L.0509270732170.1453@cash.rhiamet.com
обсуждение исходный текст
Ответ на Re: add column if doesn't exist  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-sql
p == peter_e@gmx.net writes:
p> Brandon Metcalf wrote:p> > Is there a way to check for the existence of a column in a tablep> > other than, say,
doinga SELECT on that column name and checking thep> > output?
 
p> SELECT * FROM information_schema.columns;
p> Customize to taste.


Yes, that's what I'm looking for.  Thanks.

Now, is there a way to mix PostgreSQL commands and SQL and do
something like
 ALTER TABLE foo ADD COLUMN bar WHERE EXISTS(SELECT * FROM   information_schema.columns WHERE ...)

?

-- 
Brandon


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

Предыдущее
От: jeff sacksteder
Дата:
Сообщение: Re: how to do 'deep queries'?
Следующее
От: Daryl Richter
Дата:
Сообщение: Re: how to do 'deep queries'?