[SQL] varchar::timezone conversion

2008-09-22 Thread Marc Mamin
Hi, I'm facing an issue, where I build time stamps from a set of strings. In this non working example, I'm looking for a way to cast my strings to the expected format 'timestamp' and timezone... CREATE OR REPLACE FUNCTION "public"."timestamp_to_utcms" (varchar,varchar) RETURNS int8 AS $body$

[SQL] exclusion query

2008-09-22 Thread Louis-David Mitterrand
Hi, I've got five related tables: - person_type: id_person_type integer type_fr text - person: id_person integer ... - person_to_event: id_person -> person id_person_type -> person_type (e.g: actor, di

Re: [SQL] exclusion query

2008-09-22 Thread Louis-David Mitterrand
On Mon, Sep 22, 2008 at 04:34:14PM +0200, Louis-David Mitterrand wrote: > Hi, > > I've got five related tables: > > - person_type: > id_person_type integer > type_fr text > > - person: > id_person integer > ... > > - person_to_event: >

Re: [SQL] exclusion query

2008-09-22 Thread Mark Roberts
On Mon, 2008-09-22 at 16:34 +0200, Louis-David Mitterrand wrote: > > > To select person_type's used in a certain event_type I have this > query: > > select distinct pt.type > from person_type pt > natural join person_to_event > join event e using (id_event) >

[SQL] Multi-line text fields

2008-09-22 Thread Mike Toews
Hi all, I have some records that have some multiple lines within a single text field. (On top of that, I think I have mixed DOS/UNIX line endings too). I'm looking for two functions which can operate on a single field: 1. number of lines 2. a way to select the first line or to trim to the

[SQL] Special grouping on sorted data.

2008-09-22 Thread Nicolas Beuzeboc
Hi, I was looking for a simple solution to this problem. I can't find a way to group on b and n by just collapsing sequential n's (identical n's right next to each other) the sorting condition is the timestamp. b| n | stamp A| 1 | 200

Re: [SQL] Special grouping on sorted data.

2008-09-22 Thread Tom Lane
Nicolas Beuzeboc <[EMAIL PROTECTED]> writes: > I was looking for a simple solution to this problem. I can't find a way > to group on b and n by just collapsing sequential n's (identical n's > right next to each other) the sorting condition is the timestamp. I'm not totally certain that I underst

Re: [SQL] Multi-line text fields

2008-09-22 Thread Craig Ringer
Mike Toews wrote: Hi all, I have some records that have some multiple lines within a single text field. (On top of that, I think I have mixed DOS/UNIX line endings too). I'm looking for two functions which can operate on a single field: 1. number of lines A few different ways, none of wh

Re: [SQL] Special grouping on sorted data.

2008-09-22 Thread Craig Ringer
Nicolas Beuzeboc wrote: Hi, I was looking for a simple solution to this problem. I can't find a way to group on b and n by just collapsing sequential n's (identical n's right next to each other) the sorting condition is the timestamp. b| n | stamp ---