checking for existence of a table in plpgsql.

From: Bhuvan A <bhuvansql(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: checking for existence of a table in plpgsql.
Date: 2002-03-14 05:40:35
Message-ID: Pine.LNX.4.20.0203141101100.32557-100000@Larry
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


hi,

here i use postgresql 7.2.

how can one know that a particular table exists or not in plpgsql?

need is something like this..
from plpgsql, i wish to insert a record in a table (create and insert,
if not exists).

---

create function ftest()
returns int as 'declare

begin

if <table exists> then
insert into <table> (...) values (...);
else
create <table> (...);
insert into <table> (...) values (...);
end if;

return row_count;
end;'
language 'plpgsql';

----

hope to get some lights.

Regards,
Bhuvaneswaran.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bo Lorentsen 2002-03-14 07:57:52 Re: Large data sets and FOR LOOP's
Previous Message Martijn van Oosterhout 2002-03-14 02:16:31 Re: Strange Postgresql Indexing Behavior