pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bhuvan A <bhuvansql@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: checking for existence of a table in plpgsql.
Date: Thu, 14 Mar 2002 11:10:35 +0530 (IST)
Message-ID: <Pine.LNX.4.20.0203141101100.32557-100000@Larry> (raw)


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.





view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.4.20.0203141101100.32557-100000@Larry>
Permalink:  ../Pine.LNX.4.20.0203141101100.32557-100000@Larry/
Also on:    postgresql.org/message-id/Pine.LNX.4.20.0203141101100.32557-100000@Larry

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bhuvansql@yahoo.com
  Subject: Re: checking for existence of a table in plpgsql.
  In-Reply-To: <Pine.LNX.4.20.0203141101100.32557-100000@Larry>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox