[SQL] date arithmetic

2006-08-10 Thread chrisj
Hi ALL, I want to do date arithmetic in SQL with a column that is integer. example create table bob ( col1 timestamp , col2 int4 ; where col2 represents a number of minutes. I want to do something like select col1 + interval col2 minutes from bob This is doable with most other RDBM

[SQL] error with mor than 1 sub-select

2006-08-22 Thread chrisj
Hi, I am fairly new to PostgreSQL but not to SQL. Is this a bug or a limitation... The first query works fine, but when a second sub-query is added I get a syntax error... psql protocal2 -U p2user << EOF1 select * from serv_res SR where serv_key = 10 and not exists

Re: [SQL] error with mor than 1 sub-select

2006-08-22 Thread chrisj
thanks, stupid user error. i guess the pointer on the error message led me astray Michael Fuhr wrote: > > On Tue, Aug 22, 2006 at 06:47:51PM -0700, chrisj wrote: >> The first query works fine, but when a second sub-query is added I get a >> syntax error... >> >

[SQL] Assigning a timestamp without timezone to a timestamp with timezone

2006-10-02 Thread chrisj
Hi Does any one have any ideas for the following problem? Two tables both the have open and close columns that are timestamp or timestamp with time zone. One row in first table represents the corporate office default open and close times for all stores relative to the store?s own time zone for a

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-03 Thread chrisj
answer please be patient with me sometimes I am slow but I usually get there. Andrew Sullivan wrote: > > On Mon, Oct 02, 2006 at 08:15:56PM -0700, chrisj wrote: >> Two tables both the have open and close columns that are timestamp or >> timestamp with time zone. > > I thi

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-03 Thread chrisj
Brilliant, elegant and simple !! I can't wait to try it (don't have access to Postgres 9-5 EDT) !! thank-you !! Andrew Sullivan wrote: > > On Tue, Oct 03, 2006 at 07:26:52AM -0700, chrisj wrote: >> location, but they are the directive to all store locations saying: &q

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-05 Thread chrisj
-03 > 09:00'||"timezone" as timestamp from storetz where id = 1) as a; >timestamp > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Sullivan > Sent: Tuesday, October 03, 2006 7:52 AM > To:

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-05 Thread chrisj
Hi Andrew, If only all time zones were fixed offset timezones life would be so much simpler. Unfortunately the main area of deployment of my app will beToronto which is on EDT which is not a fixed offsets timezone. I hope/assume your solution works with "EDT" instead of "-3", I will test it soo

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-05 Thread chrisj
Thanks for the heads up, I definately need EST5EDT you saved me twice!! Andrew Sullivan wrote: > > On Thu, Oct 05, 2006 at 01:06:00PM -0700, chrisj wrote: >> If only all time zones were fixed offset timezones life would be so much >> simpler. > > Indeed. > >&g

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-14 Thread chrisj
-- 2006-07-13 09:20:00-04 | 2006-07-13 10:20:00-04 (1 row) Any thoughts? On Thu, Oct 05, 2006 at 01:06:00PM -0700, chrisj wrote: > If only all time zones were fixed offset timezones life would be so much > simpler. Indeed. > Unfortunately the main area of deployment

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-15 Thread chrisj
ntax for type timestamp with time zone: "2006-07-13 09:20:00 America/New_York" Tom Lane-2 wrote: > > chrisj <[EMAIL PROTECTED]> writes: >> It works fine with fixed offset timezones, but when I try it with EST5EDT >> I get the following: >> ERROR: i

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-16 Thread chrisj
tion B where A.appt_key = 7 and B.locn_key = 102; thank-you so much Tom Lane-2 wrote: > > chrisj <[EMAIL PROTECTED]> writes: >> Did not seem to help: >> ERROR: invalid input syntax for type timestamp with time zone: >> "2006-07-13 >> 09:20:0

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-17 Thread chrisj
from 2006-10-03 09:00:00 NZST to 2006-10-03 09:00:00 EST5EDT If I am missing a much easier way to accomplish this please let me know. Tom Lane-2 wrote: > > chrisj <[EMAIL PROTECTED]> writes: >> When I first saw your solution I thought it was logically going to do >>

[SQL] recursive SQL and with clause

2006-11-15 Thread chrisj
I was just wondering when we could reasonably expect recursive SQL to be added to Postgres? I saw some posts from 2004 that made it sound like it was imminent, but I guess something went wrong? I believe the WITH clause is a pre-requisite for recursive SQL, however I do find the WITH clause also

Re: [SQL] Aggregate function to build 2-d array

2006-11-15 Thread chrisj
Hi Steven, I believe I saw something about a fix to array_append in the release notes for V8.2. Not sure if this helps. Steven Murdoch-2 wrote: > > I would like to aggregate several rows of a query, maintaining the > relative order. Is there an other way to achive the same result? I > have a

[SQL] can someone explain confusing array indexing nomenclature

2007-02-14 Thread chrisj
given the following table: protocal2=> select * from sal_emp ; name | pay_by_quarter | schedule ---+---+--- Bill | {1,1,1,1} | {{meeting,lunch},{training,presentation}} Carol | {200

Re: [SQL] can someone explain confusing array indexing nomenclature

2007-02-15 Thread chrisj
of indexes on other dimensions. I believe I understandbut incredibly confusing. - chris Achilleas Mantzios wrote: > > Στις Τετάρτη 14 Φεβρουάριος 2007 21:31, ο/η chrisj έγραψε: >> given the following table: >> >> protocal2=> select * from sal_emp ; >>

Re: [SQL] can someone explain confusing array indexing nomenclature

2007-02-16 Thread chrisj
I am quite sure the [2] is not discarded, easy enough to test but I don't have access to PG at the moment. Achilleas Mantzios wrote: > > Στις Πέμπτη 15 Φεβρουάριος 2007 18:55, ο/η chrisj έγραψε: >> Thanks Achilleas, >> >> I see what you are saying, but if we consid

Re: [SQL] can someone explain confusing array indexing nomenclature

2007-02-24 Thread chrisj
I guess you could say the [2] is discarded since the value "2" is at the top or beyond the top of the range. Achilleas Mantzios wrote: > > Στις Παρασκευή 16 Φεβρουάριος 2007 20:35, ο/η chrisj έγραψε: >> I am quite sure the [2] is not discarded, easy enough to test but I d

[SQL] can a insert with a returning clause be subquery ?

2008-02-02 Thread chrisj
I am trying to accomplish this: update p2user.party set ADDR_KEY = (insert into p2user.address ( street_no, street_name) values ('22', 'Geek St.') returning addr_key ) where party_key = 22 ; But I am getting error: ERROR: syntax error at or near "into" LINE 1