Re: [SQL] Temporary tables

2003-09-30 Thread George A.J
Thanks to all of you for your suggestions. the problem is solved by creating a function istableexist() that returns whether a table exist or not. the function is bellow. CREATE FUNCTION istableexist(varchar) RETURNS bool AS '  DECLARE  BEGIN      /* check the table exist in database and is visible

Re: [SQL] Temporary tables

2003-09-28 Thread vijaykumar M
Hi, Try the below steps .. 1. Write one procedure to create tempory table (generic purpose) ** CREATE OR REPLACE FUNCTION SP_CREATE_TEMP_TABLE () RETURNS VARCHAR AS ' DECLARE L_SchemaName name; BEGIN EXECUTE ''CREATE TEMPORARY T

Re: [SQL] Temporary tables

2003-09-27 Thread Tom Lane
"George A.J" <[EMAIL PROTECTED]> writes: > When i searched the pg_class i found the temp table name more than once. > ie, a temporary table is created for each connection.I cannot distingush > the temp tables. But the tables are in different schema. > Is there a method to get the current temporar

Re: [SQL] Temporary tables

2003-09-27 Thread Richard Huxton
On Saturday 27 September 2003 14:31, George A.J wrote: > hi, > > I am using postgresql 7.3.2. Is there any function to determine > whether a table exists in the database.Or is there any function > that returns the current temp schema. > I am using a pl/pgsql function that create and drop a temporar

Re: [SQL] Temporary tables and indexes

2002-10-08 Thread Josh Berkus
Tom, > > I'm kind of surprised that it's possible to index a temporary > table. > > There's not much point in doing so. > > Why not? You seem to be equating "temporary" with "small", but I > don't > see why that must be so. Nah. I'm equating "temporary" with "query twice and throw away", whic

Re: [SQL] Temporary tables and indexes

2002-10-08 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > I'm kind of surprised that it's possible to index a temporary table. > There's not much point in doing so. Why not? You seem to be equating "temporary" with "small", but I don't see why that must be so. regards, tom lane -

Re: [SQL] Temporary tables and indexes

2002-10-08 Thread Ian Harding
Sure there is! There are queries that benefit from having a temporary table created for a subquery and the temporary table indexed before the join. Since we can't easily return result sets from functions yet, it's not probably used that much, but from within a function, I can see why you mig

Re: [SQL] Temporary tables and indexes

2002-10-08 Thread Josh Berkus
Ludwig, > Are the indices of a temporary table automatically > "dropped" together its corresponding temporary table > after a database session? I'm kind of surprised that it's possible to index a temporary table. There's not much point in doing so. Yes, the indexes would be dropped as well.