Re: [SQL] definative way to place secs from epoc into timestamp

2005-03-04 Thread Bret Hughes
On Fri, 2005-03-04 at 01:35, Michael Glaesemann wrote: > > On Mar 4, 2005, at 14:47, Bret Hughes wrote: > > > On Thu, 2005-03-03 at 14:58, Andrew - Supernews wrote: > >> (Why are you using timestamp without time zone anyway? For recording > >> the > >

Re: [SQL] definative way to place secs from epoc into timestamp

2005-03-03 Thread Bret Hughes
On Thu, 2005-03-03 at 14:58, Andrew - Supernews wrote: > On 2005-03-03, Bret Hughes <[EMAIL PROTECTED]> wrote: > > a RFE would be to let to_timestamp be to a timezone without time zone > > and have a to_timestamptz do the time zone thing. Seems more consistent >

Re: [SQL] definative way to place secs from epoc into timestamp

2005-03-02 Thread Bret Hughes
On Thu, 2005-03-03 at 00:41, Michael Glaesemann wrote: > > On Mar 3, 2005, at 14:42, Bret Hughes wrote: > > > also my first two pgsql functions :) > > > > cat ts2int.sql > > FWIW, there's a patch in the queue for 8.1 that adds a to_timestamp > func

Re: [SQL] definative way to place secs from epoc into timestamp

2005-03-02 Thread Bret Hughes
On Thu, 2005-03-03 at 00:25, Tom Lane wrote: > Bret Hughes <[EMAIL PROTECTED]> writes: > > create function int2ts(integer) returns timestamp as ' > > SELECT ( TIMESTAMP WITH TIME ZONE \'epoch\' + $1 * INTERVAL \'1 > > second\')::timestamp

Re: [SQL] definative way to place secs from epoc into timestamp

2005-03-02 Thread Bret Hughes
On Wed, 2005-03-02 at 14:26, Tom Lane wrote: > Bret Hughes <[EMAIL PROTECTED]> writes: > > Thanks for the feed back tom I say that but I could not believe that I > > have to jump through all those hoops on an insert or update > > > update mytable set (lasttime =(S

Re: [SQL] definative way to place secs from epoc into timestamp

2005-03-02 Thread Bret Hughes
On Wed, 2005-03-02 at 13:52, Tom Lane wrote: > Bret Hughes <[EMAIL PROTECTED]> writes: > > I give up. I have STFW and STFM and still do not feel like I have a > > good way to update/insert into a timestamp w/o TZ column with an integer > > representing seconds fr

[SQL] definative way to place secs from epoc into timestamp column

2005-03-02 Thread Bret Hughes
I give up. I have STFW and STFM and still do not feel like I have a good way to update/insert into a timestamp w/o TZ column with an integer representing seconds from epoch. I am adding functionality to a php app that does a fair amount of work with time and am currently using abstime($timestamp)

Re: [SQL] how can I query for unset timestamps

2005-02-22 Thread Bret Hughes
gt; HTH, > > Greg Williamson > DBA > GlobeXPlorer LLC > > -----Original Message- > From: Bret Hughes [mailto:[EMAIL PROTECTED] > Sent: Tue 2/22/2005 1:09 PM > To: postgresql sql list > Cc: > Subject: [SQL] how can I query for unset timestamps > I

[SQL] how can I query for unset timestamps

2005-02-22 Thread Bret Hughes
I have a table that I recently altered by adding several timestamp columns. I would like to query the table for those rows for which the timestamp has not been set but am unable to find a way to do so. any tips ? in psql the column appears empty and char_length returns nothing. Some of what I h

Re: [SQL] what does ONLY do

2005-02-18 Thread Bret Hughes
On Fri, 2005-02-18 at 21:15, Stephan Szabo wrote: > On Fri, 18 Feb 2005, Bret Hughes wrote: > > > I can't seem to find an explanation of what adding ONLY does for an sql > > statement for instance : > > > > ALTER TABLE [ONLY] ADD COLUMN ... > > > &g

[SQL] what does ONLY do

2005-02-18 Thread Bret Hughes
I can't seem to find an explanation of what adding ONLY does for an sql statement for instance : ALTER TABLE [ONLY] ADD COLUMN ... or what ever. Does anyone have a pointer to docs on this. I am simply curious since there is obviously something I am missing. Bret --

Re: [SQL] trigger/for key help

2004-04-12 Thread Bret Hughes
On Sun, 2004-04-11 at 21:27, Tom Lane wrote: > Bret Hughes <[EMAIL PROTECTED]> writes: > > FWIW I tried to use alter table but could never get the parser to accept > > $1 as a constraint name. I used single and double quotes as well as a > > lame attempt \$1.

Re: [SQL] trigger/for key help

2004-04-11 Thread Bret Hughes
On Sun, 2004-04-11 at 17:00, Tom Lane wrote: > Bret Hughes <[EMAIL PROTECTED]> writes: > > elevating=# drop table test_types; > > ERROR: could not find tuple for constraint 2041971 > > > I can find no reference to these oids anywhere. > > You haven't loo

Re: [SQL] trigger/for key help

2004-04-11 Thread Bret Hughes
On Sun, 2004-04-11 at 10:17, Stephan Szabo wrote: > > On Sat, 11 Apr 2004, Bret Hughes wrote: > > > S*t s*t s*t. I have managed to screw up the system tables trying to > > delete a foreign key on a new table I was going to start using tomorrow. > > > > >

[SQL] trigger/for key help

2004-04-10 Thread Bret Hughes
S*t s*t s*t. I have managed to screw up the system tables trying to delete a foreign key on a new table I was going to start using tomorrow. elevating-# \d diag_logs Table "diag_logs" Column | Type | Modifiers

[SQL] distinct values without seq scan

2004-04-06 Thread Bret Hughes
I have a table indexed on a char(35) field and want a query to return a distinct list of the values in this column. Is there some syntactical magic I can do to get these values without a sequential scan? I assume, ( here we go again ) that these values are in the index somewhere and I seem to rec

Re: [SQL] group by not returning sorted rows

2004-04-06 Thread Bret Hughes
On Mon, 2004-04-05 at 17:34, Tom Lane wrote: > Bret Hughes <[EMAIL PROTECTED]> writes: > > and the rows resulting from the query are no longer sorted by log date. > > Is this a change since 7.2x? > > Yes. 7.4 can use hashing instead of sorting to bring grouped ro

[SQL] group by not returning sorted rows

2004-04-05 Thread Bret Hughes
I have a query: select cities.name as city, buildings.name as building, pagename, log_date , sum(exhibition_count) as tot from logrecords join cities on (logrecords.city=cities.num) join buildings on (logrecords.building=buildings.num) where adver

Re: [SQL] UPDATE comparing dates and non-dates data

2002-12-13 Thread Bret Hughes
On Fri, 2002-12-13 at 11:43, javier garcia wrote: > Hi; > I've got date data, extracted from rain gauge stations. The date of a row in > my data are structured in three integer fields, and as a result of a query I > can get the following (what is quite good for my): > cod_station | year | month

Re: [SQL] primary + foreign key

2002-12-12 Thread Bret Hughes
On Thu, 2002-12-12 at 10:27, Roberto Mello wrote: > > Read "An Introduction to Database Systems" by C.J. Date. > Boy that brings back memories. I think I will dig it out of a box since I am doing database coding again after a long hiatus. Seems like I had a couple of Date books on my shelf at