Re: [HACKERS] timestamp subtraction (was Re: [SQL] formatting intervals with to_char)

2006-10-05 Thread Jim Nasby
On Oct 5, 2006, at 11:50 AM, Tom Lane wrote: regression=# select ('2006-09-15 23:59:00'::timestamp - '2006-09-01 09:30:41'::timestamp); ?column? -- 14 days 14:28:19 (1 row) should be reporting '350:28:19' instead. This is a hack that was done to minimize the changes in t

Re: [HACKERS] timestamp subtraction (was Re: [SQL] formatting intervals with to_char)

2006-10-05 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > Considering how late it is in the cycle, perhaps the change in > behavior should come in 8.3. Yeah, there's not really enough time to think through the consequences now. I'd like to experiment with it for 8.3 though. rega

Re: [HACKERS] timestamp subtraction (was Re: [SQL] formatting intervals with to_char)

2006-10-05 Thread Michael Glaesemann
On Oct 6, 2006, at 1:50 , Tom Lane wrote: I'm tempted to propose that we remove the justify_hours call, and tell anyone who really wants the old results to apply justify_hours() to the subtraction result for themselves. Not sure what the fallout would be, though. I'm tempted to support

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

2006-10-05 Thread Hector Villarreal
Many thanks Chris, I am new to Postgresql and was trying to understand the casting portion. Appreciate it as this makes it useful for many applications where timezones matter. Thanks Hector -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of chrisj Sent:

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. > >> Unfortunately the main area of

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

2006-10-05 Thread Andrew Sullivan
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 of my app will beToronto which is > on EDT which is not a fixed offsets timezone. I hope/assume your s

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
Hi Hector, It would probably better to get the explanation from Andrew, but I will do the best I can. You asked about the 1 and -3. The 1 would be the store number in my original scenario and -3 would be the representation of the timezone (three hours behind Universal Coordinate Time). I still

Re: [SQL] Postgresql quey planner

2006-10-05 Thread Tom Lane
"=?ISO-8859-1?Q?William_Leite_Ara=FAjo?=" <[EMAIL PROTECTED]> writes: > The second does really what I desire. Show all records in table > "posto", including that's without count in table "autuados". But the first, > doesn't. Some elements on table "Posto" are ommited. What PG version is this?

Re: [SQL] On Rollback my sequency does not back the initial value

2006-10-05 Thread A. Kretschmer
am Thu, dem 05.10.2006, um 15:50:58 -0300 mailte Ezequias Rodrigues da Rocha folgendes: > Hi, > > I am implementing a function that execute a rollback then some exception is > throwed. > > The problem is that my nextval('mysequency') does not return to the initial > value when the rollback is e

[SQL] Postgresql quey planner

2006-10-05 Thread William Leite Araújo
  Estou confuso com o funcionamento do "query planner" do postgresql. Tenho 2 queries conceitualmente idênticas:  I'm confused about the planner functionality. I'd 2 queries contextualy indentical: SELECT p.pos_id, count(aut_id) as pesadosFROM posto p LEFT OUTER JOIN pesagem e USING(pos_id

[SQL] On Rollback my sequency does not back the initial value

2006-10-05 Thread Ezequias Rodrigues da Rocha
Hi,I am implementing a function that execute a rollback then some exception is throwed.The problem is that my nextval('mysequency') does not return to the initial value when the rollback is executed. Does anybody have any experiency with it ?Regards ...-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: [SQL] age() vs. timestamp substraction

2006-10-05 Thread Martin Marques
On Thu, 05 Oct 2006 14:37:24 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > Martin Marques writes: >> I just found this problem with the age() function, which AFAIK should >> give the same resulte as a subtraction of the argument from now(), > > Where did you get that idea? age's reference point

Re: [SQL] age() vs. timestamp substraction

2006-10-05 Thread Tom Lane
Martin Marques writes: > I just found this problem with the age() function, which AFAIK should > give the same resulte as a subtraction of the argument from now(), Where did you get that idea? age's reference point is current_date (ie, midnight) not now(). There are also some differences in the

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

2006-10-05 Thread Andrew Sullivan
On Wed, Oct 04, 2006 at 11:04:56AM -0700, Hector Villarreal wrote: > Hi > I am also interested in this type of setup. However, in the example > below > I am a little confused as to why the table entry is 1, -3 The 1 is an artificial key (it's the criterion in the WHERE clause). The -03 is the t

[SQL] age() vs. timestamp substraction

2006-10-05 Thread Martin Marques
I just found this problem with the age() function, which AFAIK should give the same resulte as a subtraction of the argument from now(), but it doesn't. prueba=> SELECT (now() - tc.last_cron),age(tc.last_cron),tc.intervalo FROM tareas_cron tc ; ?column? |

timestamp subtraction (was Re: [SQL] formatting intervals with to_char)

2006-10-05 Thread Tom Lane
Graham Davis <[EMAIL PROTECTED]> writes: > The documentation for to_char states that: > "|to_char(interval)| formats HH and HH12 as hours in a single day, while > HH24 can output hours exceeding a single day, e.g. >24." > However I can not get it to work with time intervals that span more than

Re: [SQL] i have table

2006-10-05 Thread Andrew Sullivan
On Wed, Oct 04, 2006 at 11:20:07AM -0500, Aaron Bono wrote: > > So do it as needed and convert your application slowly. You don't even need to do that. ALTER TABLE tablename RENAME TO tablename_real; CREATE VIEW tablename [&c.] Now the view looks to the application just like the old table.

Re: [SQL] i have table

2006-10-05 Thread Achilleas Mantzios
Στις Πέμπτη 05 Οκτώβριος 2006 16:31, ο/η Tom Lane έγραψε: > Achilleas Mantzios <[EMAIL PROTECTED]> writes: > > Alright, you could play with something like: > > > > UPDATE pg_attribute SET attnum = where > > attrelid= and attname=''; > > That's guaranteed to break his table, because the physical st

Re: [SQL] i have table

2006-10-05 Thread Tom Lane
Achilleas Mantzios <[EMAIL PROTECTED]> writes: > Alright, you could play with something like: > UPDATE pg_attribute SET attnum = where > attrelid= and attname=''; That's guaranteed to break his table, because the physical storage of the rows won't have changed. (To name only the most obvious p

Re: [SQL] i have table

2006-10-05 Thread Achilleas Mantzios
Στις Τετάρτη 04 Οκτώβριος 2006 18:37, ο/η Erik Jones έγραψε: > Aaron Bono wrote: > > On 10/4/06, *Erik Jones* <[EMAIL PROTECTED] > > > wrote: > > > > There is one non-SQL related reason that I like to be able to order > > columns, at least the way they are displaye