dbTalk Databases Forums  

Re: [BUGS] timestamp bug 7.4beta3

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] timestamp bug 7.4beta3 in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tomas Szepe
 
Posts: n/a

Default Re: [BUGS] timestamp bug 7.4beta3 - 10-15-2003 , 09:38 AM






On Oct-15 2003, Wed, 02:08 -0400
Nayib Kiuhan <nayib (AT) onlinetec (DOT) net> wrote:

Quote:
"date" timestamp DEFAULT 'now'
I believe you should be using

"date" timestampt DEFAULT CURRENT_TIMESTAMP(0)

--
Tomas Szepe <szepe (AT) pinerecords (DOT) com>

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
  #2  
Old   
Neil Conway
 
Posts: n/a

Default Re: [BUGS] timestamp bug 7.4beta3 - 10-15-2003 , 09:56 AM






On Wed, 2003-10-15 at 02:08, Nayib Kiuhan wrote:
Quote:
In versions before 7.4beta3 I use to have tables with
"date" timestamp DEFAULT 'now'
It use to works properly, placing the actual date at the moment a new
record was inserted. Now it always have the same date which correspond
to the date at creating the table.

From the 7.4 HISTORY file:
'now' will no longer work as a column default, use now() (change
required for prepared statements) (Tom)

Admittedly, this change should also be noted in the 'migration to 7.4
section' of the release notes -- I'll send a patch to this effect to
pgsql-patches.

-Neil



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
  #3  
Old   
Neil Conway
 
Posts: n/a

Default Re: [BUGS] timestamp bug 7.4beta3 - 10-15-2003 , 01:45 PM



On Wed, 2003-10-15 at 13:29, Nayib Kiuhan wrote:
Quote:
It is a good idea to through out an error during the table creation if
the format is not as indicated (now()), because when I created my
tables with the old format, it did not show any problem
I agree that this kind of silent backward-incompatibility isn't good,
but I don't think that we can reject 'now' or its variants outright:
it's legal syntax, it just doesn't do what you might expect.

Since Tom implemented this change, perhaps he can contribute some
insight -- Tom, can we improve the upgrade experience in this case?

-Neil



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #4  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] timestamp bug 7.4beta3 - 10-15-2003 , 02:53 PM



Neil Conway <neilc (AT) samurai (DOT) com> writes:
Quote:
I agree that this kind of silent backward-incompatibility isn't good,
It's unpleasant, but we were going to have to bite this bullet sooner or
later. Allowing 'now' to work like a non-constant in this context was
always a fragile hack.

Quote:
Tom, can we improve the upgrade experience in this case?
I don't see any very simple way; certainly not anything I'd want to
stick in in a last-minute fashion. There are too many possible
representations of 'now', and if we did try to substitute now() we'd
be disabling a legal (if possibly useless) behavior.

It's not like it's hard to fix post-upgrade (or pre-upgrade, for that
matter): a simple "ALTER TABLE ... SET DEFAULT now()" will do it.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #5  
Old   
Nayib Kiuhan
 
Posts: n/a

Default Re: [BUGS] timestamp bug 7.4beta3 - 10-16-2003 , 11:17 AM



=20
Quote:
It's not like it's hard to fix post-upgrade (or pre-upgrade, for that
matter): a simple "ALTER TABLE ... SET DEFAULT now()" will do it.
Like 'now' and now() are both valid, at least will be good to have a note w=
hen a table that includes 'now' is created, bringing the attention to peopl=
e to review 'now' and now() functionalities.

Regards,

Nayib


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #6  
Old   
Nayib Kiuhan
 
Posts: n/a

Default Re: [BUGS] timestamp bug 7.4beta3 - 10-16-2003 , 11:17 AM



Thank you for your answer. I tried before with 'now()' (inside the single a=
spen) and didn't work . Now it is working very well without the aspens as y=
ou already mentioned. It is a good idea to through out an error during the =
table creation if the format is not as indicated (now()), because when I cr=
eated my tables with the old format, it did not show any problem, I just fi=
gure out that something was wrong with my tables once my java program start=
to do weird things.

Again, many thanks,

Nayib


----- Original Message -----=20
From: "Neil Conway" <neilc (AT) samurai (DOT) com>
To: "Nayib Kiuhan" <nayib (AT) onlinetec (DOT) net>
Cc: <pgsql-bugs (AT) postgresql (DOT) org>
Sent: Wednesday, October 15, 2003 10:50 AM
Subject: Re: [BUGS] timestamp bug 7.4beta3


Quote:
On Wed, 2003-10-15 at 02:08, Nayib Kiuhan wrote:
In versions before 7.4beta3 I use to have tables with=20
"date" timestamp DEFAULT 'now'=20=20=20
It use to works properly, placing the actual date at the moment a new
record was inserted. Now it always have the same date which correspond
to the date at creating the table.
=20
From the 7.4 HISTORY file:
=20
'now' will no longer work as a column default, use now() (change
required for prepared statements) (Tom)
=20
Admittedly, this change should also be noted in the 'migration to 7.4
section' of the release notes -- I'll send a patch to this effect to
pgsql-patches.
=20
-Neil
=20
=20
=20

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.