Shaun Clements wrote:
Hi
Hate to ask, but it isnt obvious to me from the documentation.
How do I perform a query in pgplsql, to check it a table exists of a
particular name.
Thanks in advance
Kind Regards,
Shaun Clements
-- A list of tables:
SELECT schemaname, tablename FROM pg_tables;
-- Returns
Title: RE: [GENERAL] pl sql to check if table of table_name exists
Hi
Hate to ask, but it isnt obvious to me from the documentation.
How do I perform a query in pgplsql, to check it a table exists of a particular name.
Thanks in advance
Kind Regards,
Shaun Clements
Title: RE: [GENERAL] pl sql to check if table of table_name exists
Much appreciated.
Thanks
Kind Regards,
Shaun Clements
-Original Message-
From: Adam Tomjack [mailto:[EMAIL PROTECTED]]
Sent: 10 March 2005 11:04 AM
To: Shaun Clements
Cc: postgresql
Subject: Re: [GENERAL] pl sql to
Shaun Clements wrote:
Hi
Hate to ask, but it isnt obvious to me from the documentation.
How do I perform a query in pgplsql, to check it a table exists of a
particular name.
Check the manual. There are two ways to d othis. You could query the
data catalogs directly (something like count(*)
Title: RE: [GENERAL] pl sql to check if table of table_name exists
selectyour_tablename from pg_class where
relkind='r'
"Shaun Clements" [EMAIL PROTECTED] wrote in
message news:[EMAIL PROTECTED]...
Hi
Hate to ask, but it isnt obvious to me from the
documentation. How do I perform
Title: RE: [GENERAL] pl sql to check if table of table_name exists
i mean
select* from pg_class where relkind='r' and
relname=your_tablename
"Sim Zacks" [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
selectyour_tablename from pg_class where
relkind='r'
"Shaun
Title: RE: [GENERAL] pl sql to check if table of table_name exists
Hi
Sim
Thanks for your response. I had it working from a
previous post by Adam Tomjack.
snip
-- A list of tables:
SELECT schemaname, tablename FROM pg_tables;
-- Returns true if a table exists:
SELECT count(*)0 FROM
Title: RE: [GENERAL] pl sql to check if table of table_name exists
I'm gladto hear yougot itworking.
In explanation to my response:
the pg_class internal table lists all the
relationships in the database.
relkind='r' means that the relation you are looking
for is a table (relation), I
Title: RE: [GENERAL] pl sql to check if table of table_name exists
Hi
Sim
Thanks for your input.
Kind Regards,Shaun
Clements
-Original
Message-From: Sim Zacks
[mailto:[EMAIL PROTECTED]Sent: 10 March 2005 02:47 PMTo:
pgsql-general@postgresql.orgSubject: Re: [GENERAL] pl sql to