Re: [SQL] Removing simliar elements from a set

2003-09-27 Thread Dan Langille
On 26 Sep 2003 at 16:55, Josh Berkus wrote: > Dan, > > > I'm trying to remove items from a set which are similar to items in > > another set. > > > > In short, we remove all items from MASTER which are under the directories > > specified in MATCHES. > > from your example, you are trying to re

[SQL] Temporary tables

2003-09-27 Thread George A.J
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 temporary table.The procedure run correctly for the first time for each data

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

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

[SQL] pg_class.relpages

2003-09-27 Thread Bertrand Petit
Does the figures stored in pg_class.relpages include the pages consumed by the toast tables linked to a normal table? -- %!PS 297.6 420.9 translate 90 rotate 0 setgray gsave 0 1 1{pop 0 180 moveto 100 180 170 100 170 -10 curveto 180 -9 180 -9 190 -10 curveto 190 100 100 180 0 180 curveto

Re: [SQL] pg_class.relpages

2003-09-27 Thread Bruce Momjian
Bertrand Petit wrote: > > Does the figures stored in pg_class.relpages include the pages > consumed by the toast tables linked to a normal table? No. See the chapter on monitoring disk space for more information. -- Bruce Momjian| http://candle.pha.pa.us [EMA

Re: [SQL] pg_class.relpages

2003-09-27 Thread Tom Lane
Bertrand Petit <[EMAIL PROTECTED]> writes: > Does the figures stored in pg_class.relpages include the pages > consumed by the toast tables linked to a normal table? No. The toast tables have their own pg_class.relpages entries ... regards, tom lane

Re: [SQL] pg_class.relpages

2003-09-27 Thread Bertrand Petit
On Sat, Sep 27, 2003 at 08:26:16PM -0400, Bruce Momjian wrote: > Bertrand Petit wrote: > > > > Does the figures stored in pg_class.relpages include the pages > > consumed by the toast tables linked to a normal table? > > No. See the chapter on monitoring disk space for more information.

[SQL] Mystery function error

2003-09-27 Thread Richard Sydney-Smith
As I am converting from Sybase I wanted to create a function which would replicate the behaviour of the sybase "Locate" command.   The goal is to have   locate( stra, strb) = position(strb in stra)   where "position" is the standard postgres function for the index position of string "A" in

Re: [SQL] Mystery function error

2003-09-27 Thread Joe Conway
Richard Sydney-Smith wrote: CREATE OR REPLACE FUNCTION public.locate(bpchar, bpchar) RETURNS int4 AS ' -- search for the position of $2 in $1 declare srcstr alias for $1; searchstr alias for $2; begin return position(searchstr in srcstr); ' LANGUAGE 'plpgsql' VOLATILE; You are missing the "end"

Re: [SQL] Mystery function error

2003-09-27 Thread Josh Berkus
Richard, >--- CREATE OR REPLACE FUNCTION public.locate(bpchar, > bpchar) > RETURNS int4 AS > ' > -- search for the position of $2 in $1 > > declare > srcstr alias for $1; > searchstr alias for $2; > > begin > return position(searchstr in srcstr); You're missi

Re: [SQL] Mystery function error

2003-09-27 Thread Josh Berkus
Richard, > The goal is to have > > locate( stra, strb) = position(strb in stra) Also, this will run faster if you do it as a SQL function: CREATE FUNCTION locate ( text, text ) RETURNS INT AS ' SELECT POSITION($2, $1); ' LANGUAGE SQL IMMUTABLE STRICT; -- Josh Berkus Aglio Database Solutions Sa