Re: if exists?
От | Marin Dimitrov |
---|---|
Тема | Re: if exists? |
Дата | |
Msg-id | 003b01c1fa92$794838b0$9ba1d53e@sirma.bg обсуждение исходный текст |
Ответ на | if exists? (Vincent Stoessel <vincent@xaymaca.com>) |
Список | pgsql-general |
----- Original Message ----- From: "Vincent Stoessel" > Is there an sql query that I can use on postgres that will tell > me if a table exists? select relname from pg_class where relowner = (select usesysid from pg_user where usename='USERNAME') and relkind='r'; ...will give u the list of all tables owned by user USERNAME so something like: select count(*) from pg_class where relname = 'TABLENAME' and relkind='r' and relowner = (select usesysid from pg_user where usename='USERNAME'); ...will return 0 if the table does not exist hth, Marin ---- "...what you brought from your past, is of no use in your present. When you must choose a new path, do not bring old experiences with you. Those who strike out afresh, but who attempt to retain a little of the old life, end up torn apart by their own memories. "
В списке pgsql-general по дате отправления: