From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Harry Yau <harry(at)aurasound(dot)com(dot)hk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Which Schema I am working on?? |
Date: | 2003-07-15 18:24:40 |
Message-ID: | 4336.1058293480@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Harry Yau <harry(at)aurasound(dot)com(dot)hk> writes:
> I am writing a pl/psql function with a temp table right now.
> It creates the temp table inside. Whenever I call this function in a
> session for the first time, it creates a shema, namely pg_temp_number,
> automatically and it creates the temp table within the schema. I've
> tried to add a check inside the function to check have the temp table
> been already existed.
Try something like
IF EXISTS(SELECT 1 FROM pg_class
WHERE relname = 'tablexxx' AND pg_table_is_visible(oid))
THEN ... drop it ...
The visibility check will reject temp tables belonging to other
sessions.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Vincent Hikida | 2003-07-15 18:38:40 | Re: Fw: select null + 0 question |
Previous Message | Frank Finner | 2003-07-15 18:06:17 | Re: Are you frustrated with PostgreSQL |