Re: [SQL] Joining with result of a plpgsql function

2008-05-07 Thread Matthew T. O'Connor
Stephan Szabo wrote: On Wed, 7 May 2008, Matthew T. O'Connor wrote: But I would really like to be able to combine it with other data and get a result set that looked like: f.id, f.name, tms_summary.col1, tms_summary.col2 ... Well I think select f.id, f.name, (tms.get_tms_summary(f.id

Re: [SQL] Joining with result of a plpgsql function

2008-05-07 Thread Stephan Szabo
On Wed, 7 May 2008, Matthew T. O'Connor wrote: > I have a pl/pgsql function, defined as: > > CREATE FUNCTION tms.get_tms_summary(id integer) >RETURNS tms.tms_summary > > get_tms_summary returns a composite type, tms_summary, which is > comprised of several numerics. > > What I would like to d

[SQL] Joining with result of a plpgsql function

2008-05-07 Thread Matthew T. O'Connor
Hello, I have a pl/pgsql function, defined as: CREATE FUNCTION tms.get_tms_summary(id integer) RETURNS tms.tms_summary get_tms_summary returns a composite type, tms_summary, which is comprised of several numerics. What I would like to do is something like: select f.id, f.name, tms.get_tms

Re: [SQL] Insert with pl/pgsql trigger

2008-05-07 Thread Tom Lane
"Woody Woodring" <[EMAIL PROTECTED]> writes: > My trigger is : > CREATE OR REPLACE FUNCTION log_cpe_health() RETURNS trigger AS ' >DECLARE >BEGIN > -- Update last outage before inserting > EXECUTE ''INSERT INTO cpe_health_history VALUES '' || NEW; >END; > ' LANGUAGE plpgsql;

Re: [SQL] how to check if a point is contained in a polygon ?

2008-05-07 Thread Tom Lane
Julien Cigar <[EMAIL PROTECTED]> writes: > Is there an SQL function to check if a point is contained in a polygon > shape (before I start to write my own) ? > I tried something like : > rodentia=> select point '(-8,25)' <@ polygon > '((-3,10),(8,18),(-3,30),(-10,20))'; > ERROR: operator does not

Re: [SQL] how to check if a point is contained in a polygon ?

2008-05-07 Thread Julien Cigar
Oops, you're right .. I'm still running 8.1 and I missed this note in the documentation : "Note: Before PostgreSQL 8.2, the containment operators @> and <@ were respectively called ~ and @. These names are still available, but are deprecated and will eventually be retired." thanks On Wed, 2008-0

[SQL] Insert with pl/pgsql trigger

2008-05-07 Thread Woody Woodring
I am trying to create a table that is a log of another table in 8.3.1 using a trigger. Both tables look like Table "public.cpe_health_history" Column|Type| Modifiers --++--- cpe_healthid | integer| not null mac | macaddr| po

Re: [SQL] how to check if a point is contained in a polygon ?

2008-05-07 Thread Richard Huxton
Julien Cigar wrote: Hello, I'm busy to work on an application where the user can select (with precision) an area on a map (for example the contours of a lake) and I have to retrieve all the data (specimen observations) within this area. I have a list of coordinates pair [(lat1, long1), (lat2,

[SQL] how to check if a point is contained in a polygon ?

2008-05-07 Thread Julien Cigar
Hello, I'm busy to work on an application where the user can select (with precision) an area on a map (for example the contours of a lake) and I have to retrieve all the data (specimen observations) within this area. I have a list of coordinates pair [(lat1, long1), (lat2, long2), (lat3, long3),

Re: [SQL] dbmirror - migration to 8.3 from 7.4

2008-05-07 Thread Achilleas Mantzios
Στις Wednesday 07 May 2008 14:49:31 ο/η Claus Guttesen έγραψε: > > we have been running our own heavily modified/enhanced version of dbmirror, > > running on 7.4 for some years, > > and now it is the time to upgrade to 8.3. > > > > The way i find the primary key of a table is: > >SELECT in

Re: [SQL] dbmirror - migration to 8.3 from 7.4

2008-05-07 Thread Claus Guttesen
>> The way i find the primary key of a table is: >>SELECT indkey FROM pg_index WHERE indisprimary='t' AND >> indrelid=TABLEOID; >> i noticed that some columns have been added to pg_index : indisvalid, >> indcheckxmin, indisready,indoption >> Should i include any of them (e.g. indisvalid)

Re: [SQL] dbmirror - migration to 8.3 from 7.4

2008-05-07 Thread Claus Guttesen
> we have been running our own heavily modified/enhanced version of dbmirror, > running on 7.4 for some years, > and now it is the time to upgrade to 8.3. > > The way i find the primary key of a table is: >SELECT indkey FROM pg_index WHERE indisprimary='t' AND > indrelid=TABLEOID; > i not

[SQL] dbmirror - migration to 8.3 from 7.4

2008-05-07 Thread Achilleas Mantzios
Hi, we have been running our own heavily modified/enhanced version of dbmirror, running on 7.4 for some years, and now it is the time to upgrade to 8.3. We have called our approach "Conditional row grained + FK dependency oriented lazy replication", that is, any FK dependencies of a row are tran