Re: change in timestamp output from 8.3 to 8.4 - Mailing list pgsql-hackers

From Joe Conway
Subject Re: change in timestamp output from 8.3 to 8.4
Date
Msg-id 4A76318B.3010005@joeconway.com
Whole thread Raw
In response to Re: change in timestamp output from 8.3 to 8.4  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>> 1. Two functions were left in the 8.4 database
>>     pg_toasttbl_drop(oid)
>>     pg_toasttbl_recreate(oid, oid)
>
> This is pg_migrator's fault --- it should probably clean those up
> when it's done.

I figured as much. Not a big deal though...

>> 3. All timestamps in the data that have two decimal places on seconds,
>>    but end with zero, in the 8.3 dump become one decimal place in the
>>    8.4 dump
>
>> I have to apologize for missing it if this has been discussed already,
>> but was this change intentional, and if so is there any way to force the
>> old behavior?
>
> Yes, it was intentional.  The discussion about changing it was
> around here:
> http://archives.postgresql.org/pgsql-hackers/2008-10/msg00394.php
>
> There's no exposed way to undo it, but you could probably revert the
> logic change in TrimTrailingZeros() until you'd convinced yourself
> things were okay.

Ah, just the shortcut I was hoping for :-)

For the record, and anyone else trying to validate 8.3 to 8.4
migrations, the attached patch against 8.3.x makes it behave the same as
8.4.x. This reduced my version-to-version data diff to zilch.

Thanks!

Joe

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iQIcBAEBCAAGBQJKdjGLAAoJEDfy90M199hlfOoP/3W+kXcvwzfVAxG/2rJWkKBP
ZRX0AG++kNDlzsMWCBSFfht2f3ERu0jnECKwnFb0+JF1EaWQJrPaGar1QqJ1IHZb
Iw9AjJE7LvwgcbC8mGmx1zTaI/DPwOvb+LvJIzUtXeoBLGyJuopvGWbcoOvZxvIX
dZkE97JOS0buTiUtUFedx/fpOv7ck/IRhlC4v83ghWl27mWwQ3K9U9S3kRSy3jB+
ajG0MQ3dSfK7usUgV8tfzdFkHQ8+L8PhehfBgRuqNGS1BQQvbNm7sOLnyjqB35w8
gWI37EZ6NMvVMS+880Y9+ktwpgVqVtAfzshtfzJq8HwtvWSiq6OF5wDhlxtwYLdW
h7xhvK37LoXutPMcf/HjflKoI1c9IhDj6CCwHyrxDRRjzfAvpJu7C+in9JrbvhvV
P1o5PpXuxokwafmNi6Nl8TE9s9Mjagw30tPKTK36IRfbAflbRpAByc39qvSXSRWB
xjzPYVHMY0Vwxmup+A7FXvdbzgC6t2n4O18302By0PKpPkMDZw3vhkJKgWF+i4Ux
no+GdL9Al3srpw4fvqr+GwPu8VnVFo+9fzCTlVMB2ayKWEFghCZUEriNBPJwiWaB
X9LtvrU47S5QkKUNQ0Knbs7Z1jEkIYIVnTIRvm6/Uo+5v2dAgss/0qF6wOx0gbUO
5EqsqcZzKhtkSjWxld7t
=eJkn
-----END PGP SIGNATURE-----
Index: src/backend/utils/adt/datetime.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v
retrieving revision 1.184.2.3
diff -c -r1.184.2.3 datetime.c
*** src/backend/utils/adt/datetime.c    2 Oct 2008 13:47:44 -0000    1.184.2.3
--- src/backend/utils/adt/datetime.c    3 Aug 2009 00:26:53 -0000
***************
*** 408,424 ****
  {
      int            len = strlen(str);

! #if 0
!     /* chop off trailing one to cope with interval rounding */
!     if (strcmp(str + len - 4, "0001") == 0)
!     {
!         len -= 4;
!         *(str + len) = '\0';
!     }
! #endif
!
!     /* chop off trailing zeros... but leave at least 2 fractional digits */
!     while (*(str + len - 1) == '0' && *(str + len - 3) != '.')
      {
          len--;
          *(str + len) = '\0';
--- 408,414 ----
  {
      int            len = strlen(str);

!     while (len > 1 && *(str + len - 1) == '0' && *(str + len - 2) != '.')
      {
          len--;
          *(str + len) = '\0';

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE ... ALTER COLUMN ... SET DISTINCT
Next
From: Andres Freund
Date:
Subject: Re: machine-readable explain output v4