On Dec 29, 2007, at 3:16 PM, Marcin Krawczyk wrote:
I just realized something... my bad. It will work since TRUNCATE
removes only table from current session.
If the table exists and you're going to TRUNCATE it before using it,
you could just use DROP TABLE IF EXISTS and then create it. I
- Original message --
From: "Marcin Krawczyk" <[EMAIL PROTECTED]>
> Hi all. Is there a way to determine the existence of a TEMP
> TABLE? I need to check i it exists before I create it. Doing simple
> check on pg_class or pg_tables is
> not enough because there may be
Hello
my solution isn't 100% perfect too. Better is test visibility:
SELECT n.nspname as "Schema",
c.relname as "Name",
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i'
THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as
"Type",
r.rolname as "Owner"
FROM p
I just realized something... my bad. It will work since TRUNCATE removes
only table from current session.
Thank you again.
Regards
Thanks for the answer but it's not quite sufficient. The code supplied on
his page:
CREATE OR REPLACE FUNCTION ...
BEGIN
PERFORM 1 FROM pg_catalog.pg_tables
WHERE tablename = 'xx' AND schemaname LIKE 'pg_temp%';
IF FOUND THEN
TRUNCATE xx;
ELSE
CREATE TEMP TABLE xx(...
END IF;
The function does ex
Hello
On 29/12/2007, Marcin Krawczyk <[EMAIL PROTECTED]> wrote:
> Hi all. Is there a way to determine the existence of a TEMP TABLE? I need to
> check i it exists before I create it.
> Doing simple check on pg_class or pg_tables is
> not enough because there may be other such tables created in oth
Hi all. Is there a way to determine the existence of a TEMP
TABLE? I need to check i it exists before I create it. Doing simple
check on pg_class or pg_tables is
not enough because there may be other such tables created in other sessions.
Or maybe anyone knows the identification (apart from 'others
Trilok Kumar wrote:
Hi All,
I have a table called
vehicle_duty_cycle_summary
vehicle_master_id | starting_odometer |
ending_odometer | login_time |
logout_time
---+---+-++---
Hi All,
I have a table called
vehicle_duty_cycle_summary
vehicle_master_id | starting_odometer |
ending_odometer | login_time |
logout_time
---+---+-++
4 |