Re: [SQL] Select For Update and Left Outer Join

2011-06-15 Thread greg.fenton
On Apr 28, 2:00 am, pate...@patearl.net (Patrick Earl) wrote: > This is a follow-up to an old message by Tom Lane: > >    http://archives.postgresql.org/pgsql-sql/2006-10/msg00080.php > [...] > > select * from Pet > left join Dog on Dog.Id = Pet.Id > left join Cat on Cat.Id = Pet.Id > > Now suppo

[SQL] Merge overlapping time-periods

2011-06-15 Thread Jira, Marcel
Hi! Although I try for some time, I am not able to write an SQL-Query that can do the following: I have a very big table (let's call it "mytable") with information like this: ID BEG END 1 2000-01-01 2000-03-31 1 2000-04-01 2000-05-31 1 2000-04-15 2000-07-31 1 2000-09-01

[SQL] Calling inner functions vs. Begin-End blocs

2011-06-15 Thread Charles N. Charotti
Hi Everybody ! I'm just wondering what is really better in terms of performance ... I have a large function that makes many things, and I must control the exception of some parts of the code ... whats better in terms of performance ... to catch exceptions in several inner "Begin-End" blocs in

Re: [SQL] Merge overlapping time-periods

2011-06-15 Thread F. BROUARD / SQLpro
I write a paper on this topic comparing queries for PG, SQL Server and MySQL. Can you read french ? http://blog.developpez.com/sqlpro/p9821/langage-sql-norme/agregation-d-intervalles-en-sql-1/ The worst query is the RECURSIVE one ! A + Le 15/06/2011 17:23, Jira, Marcel a écrit : Hi! Althou

Re: [SQL] Merge overlapping time-periods

2011-06-15 Thread Oliveiros d'Azevedo Cristina
Howdy, Marcel, In the example output you provided the ID = 2 should have just one record...Ain't I right? Best, Oliveiros - Original Message - From: Jira, Marcel To: 'pgsql-sql@postgresql.org' Sent: Wednesday, June 15, 2011 4:23 PM Subject: [SQL] Merge overlapping time-perio

Re: [SQL] Merge overlapping time-periods

2011-06-15 Thread Oliveiros d'Azevedo Cristina
Hello again, Marcel. I tried this and it seems to work on the example you provided, iif my understanding is correct and you want the ID=2 to have just one record on final output. That makes sense to me because 2 2000-01-15 2000-03-31 2 2000-04-01 2000-04-15 are in direct sequence (I

[SQL] finding gaps in temporal data

2011-06-15 Thread Samuel Gendler
I have a fact table that looks like this: dim1_fk bigint, time_fk bigint, tstamp timestamp without timezone value numeric(16,2) The tstamp column is completely redundant to a colume in the time_utc table, but I like to leave it there for convenience when writing ad-hoc queries in psql - it allows

Re: [SQL] Storage of Indian Language text in postgresql through PHP

2011-06-15 Thread Jasen Betts
On 2011-06-14, INDER wrote: > Hello Everyone. I am new to this group and as well as to the Postgres > also. Can anybody tell me that how to insert hindi text into postgres > that a user has entered from html input with the use of PHP. Please I > am waiting for the reply. add this PHP before any c

Re: [SQL] finding gaps in temporal data

2011-06-15 Thread Samuel Gendler
On Wed, Jun 15, 2011 at 10:23 AM, Samuel Gendler wrote: > I have a fact table that looks like this: > > dim1_fk bigint, > time_fk bigint, > tstamp timestamp without timezone > value numeric(16,2) > > The tstamp column is completely redundant to a colume in the time_utc > table, but I like to leave

[SQL] " ::= " grammar rule not accepted by Postgres

2011-06-15 Thread Clem Dickey
This expression is (I think) a well-formed query, but is rejected by Postgresql 8.4 (t is a table name). t t1 NATURAL JOIN t t2; Here is the relevant parts of grammar (with some optional elements omitted for simplicity): ::= ::= ::= ::= NATURAL JOIN ::= ::= [ ]

Re: [SQL] " ::= " grammar rule not accepted by Postgres

2011-06-15 Thread Tom Lane
Clem Dickey writes: > This expression is (I think) a well-formed query, but is rejected by > Postgresql 8.4 (t is a table name). > t t1 NATURAL JOIN t t2; Hmm ... I think you are looking at SQL92 or SQL99. The later versions of the spec don't seem to permit to be used that way. In particular