[SQL] UNION and ORDER BY ... IS NULL ASC

2003-04-04 Thread A.M.
PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.95.3 I have come across some unexpected behavior while dealing with a UNION and ORDER BY. I'd like some advice. Here's a scenario where I want to order by null values: CREATE TABLE test(a int); SELECT a FROM test UNION SELECT a FROM test

Re: [SQL] timestamp with postgresql 7.3

2003-04-04 Thread Claude
Thanks, that made the trick. On Fri, 4 Apr 2003, Stephan Szabo wrote: > > On Fri, 4 Apr 2003, Claude wrote: > > > I have a table a field with timestamps in seconds since epoch and I would > > like to get a human readable date... but it seems that postgresql 7.3 does > > not support the datetime(

Re: [SQL] timestamp with postgresql 7.3

2003-04-04 Thread Stephan Szabo
On Fri, 4 Apr 2003, Claude wrote: > I have a table a field with timestamps in seconds since epoch and I would > like to get a human readable date... but it seems that postgresql 7.3 does > not support the datetime(), timestamp(), timestamptz() functions... I'd say probably something like: CAST(

Re: [SQL] timestamp with postgresql 7.3

2003-04-04 Thread Dan Langille
On 4 Apr 2003 at 22:18, Claude wrote: > > Hi, > > I have a table a field with timestamps in seconds since epoch and I > would like to get a human readable date... but it seems that > postgresql 7.3 does not support the datetime(), timestamp(), > timestamptz() functions... > > I tried the exampl

[SQL] timestamp with postgresql 7.3

2003-04-04 Thread Claude
Hi, I have a table a field with timestamps in seconds since epoch and I would like to get a human readable date... but it seems that postgresql 7.3 does not support the datetime(), timestamp(), timestamptz() functions... I tried the example in: http://archives.postgresql.org/pgsql-bugs/2002-07/m

[SQL]unsubscribe

2003-04-04 Thread Raj Arya
unsubscribe

Re: [PERFORM] [SQL] can i make this sql query more efficiant?

2003-04-04 Thread Josh Berkus
Manfred, > I'd be honestly interested in the circumstances where you made that > observation. H ... one of my database involves a "crosstab" converstion where there were 13 possible values, and the converted table is heavily indexed. For that case, I found using CASE statements to be slowe

Re: [SQL] can i make this sql query more efficiant?

2003-04-04 Thread Josh Berkus
Tomasz, > What about this: > select > event, > sum(case when level=1 then 1 else 0 end) as ones, > sum(case when level=2 then 1 else 0 end) as twos, > sum(case when level=3 then 1 else 0 end) as threes > from baz > group by event; That version is only more efficient for small data sets.

Re: [SQL] Finding if a temp table exists in the current connection

2003-04-04 Thread Christoph Haller
> > Is there a way (i.e., access theinternal pg_ tables) to find out if a > particular temp table already exists (in the current connection)? > > I have written some stored procedures that check if a table exists and if a > column exists in a table. This is used so I can perform upgrades of our >

Re: [SQL] string variable with spaces in psql

2003-04-04 Thread Christoph Haller
> > I need to define a variable in psql, but the variable needs to contain a > space: > > This is what I want to do; > > \set theName '\''John Nobody '\'' > SELECT add_agent( :theName, 'Test Company', 'Test Department' ); > > ... > etc > > Unfortunately psql removes the space, so that theName = 'Jo