Thread: pg_type.h regression?

pg_type.h regression?

From
Greg Sabino Mullane
Date:
Looks like the box-array semicolon got changed to a comma at some point -
attached patch changes it back (\054 to \073)

--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200809222227
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

Attachment

Re: pg_type.h regression?

From
Tom Lane
Date:
Greg Sabino Mullane <greg@turnstep.com> writes:
> Looks like the box-array semicolon got changed to a comma at some point -
> attached patch changes it back (\054 to \073)

[ scratches head... ]  I seem to have done that in rev 1.198, but I
don't recall why.  It's late here though ...
        regards, tom lane


Re: pg_type.h regression?

From
Tom Lane
Date:
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Greg Sabino Mullane <greg@turnstep.com> writes:
>> Looks like the box-array semicolon got changed to a comma at some point -
>> attached patch changes it back (\054 to \073)

> [ scratches head... ]  I seem to have done that in rev 1.198, but I
> don't recall why.  It's late here though ...

I think my reasoning was that all array types should have typdelim = ','
for consistency.  It doesn't actually matter because nothing looks at
the value ... the element type's delimiter is what array_in/out use.
        regards, tom lane


Re: pg_type.h regression?

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

>> [ scratches head... ]  I seem to have done that in rev 1.198, but I
>> don't recall why.  It's late here though ...

> I think my reasoning was that all array types should have typdelim = ','
> for consistency.  It doesn't actually matter because nothing looks at
> the value ... the element type's delimiter is what array_in/out use.

Ah, okay, that makes sense. Thanks for the explanation, I'll tweak
my code to do it the right way by looking at the base type.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200809230934
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkjY8GIACgkQvJuQZxSWSsiOxgCgmpuxlkzQYlJNCdNCGc7houn7
hwQAoKfyLX3t5ArtEzaytD+nWOCl/br1
=QNIJ
-----END PGP SIGNATURE-----




Re: pg_type.h regression?

From
Tom Lane
Date:
"Greg Sabino Mullane" <greg@turnstep.com> writes:
>> I think my reasoning was that all array types should have typdelim = ','
>> for consistency.  It doesn't actually matter because nothing looks at
>> the value ... the element type's delimiter is what array_in/out use.

> Ah, okay, that makes sense. Thanks for the explanation, I'll tweak
> my code to do it the right way by looking at the base type.

Well, plan B is that we could redefine things as "all array types should
have typdelim equal to their base type's typdelim".  The backend still
wouldn't care, but if there are other clients out there confusing the
two, maybe this is important to worry about.

DefineType currently always sets the array's typdelim to ',', so I
figured that the built-in types should match that.  But we could
easily change both of them to do the other.  Thoughts?
        regards, tom lane


Re: pg_type.h regression?

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> Well, plan B is that we could redefine things as "all array types should
> have typdelim equal to their base type's typdelim".  The backend still
> wouldn't care, but if there are other clients out there confusing the
> two, maybe this is important to worry about.

+1

> DefineType currently always sets the array's typdelim to ',', so I
> figured that the built-in types should match that.  But we could
> easily change both of them to do the other.  Thoughts?

I'd slightly lean towards keeping it the way it has been (semicolon in both),
since it doesn't matter to the backend, and who knows what else it may break.
Kind of silly to spend too many cycles on this, of course, as it's
really only "box" at the moment that uses a non-standard delimiter. :)

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200809231133
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkjZDGcACgkQvJuQZxSWSsi6uACg1xS7oQu5JCzM9cWsvHAsMO66
GFkAnAtMFmSIEC+tQYqJ/4KDhco9ZXKK
=hR1M
-----END PGP SIGNATURE-----



Re: pg_type.h regression?

From
Tom Lane
Date:
"Greg Sabino Mullane" <greg@turnstep.com> writes:
>> DefineType currently always sets the array's typdelim to ',', so I
>> figured that the built-in types should match that.  But we could
>> easily change both of them to do the other.  Thoughts?

> I'd slightly lean towards keeping it the way it has been (semicolon in both),
> since it doesn't matter to the backend, and who knows what else it may break.

Well, the problem is that we'd *not* be keeping it the same for
user-defined types.  But the odds that that's really an issue are
admittedly small.

I thought of an argument for changing to array-uses-element's-typdelim,
though.  If we ever go over to a scheme where arrays are one-dimensional
and you build up N-dimensional arrays using arrays of array objects
(where the outer array treats the inner as a black box), then we would
need the typdelims to match to preserve the current I/O behavior.
I'm not really enamored of making such a change myself, but I seem to
recall a couple of people advocating for it.

So, if no objections I'll revert the change to _box's typdelim and
change DefineType to copy the element typdelim to the array type.
        regards, tom lane