Re: [HACKERS] Data type removal - Mailing list pgsql-hackers

From
Subject Re: [HACKERS] Data type removal
Date
Msg-id emacs-smtp-20243-13592-4566-337545@export.andrew.cmu.edu
Whole thread Raw
In response to Re: [HACKERS] Data type removal  (dg@illustra.com (David Gould))
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----

> From: dg@illustra.com (David Gould)
> > Speaking of data type removal, I was wondering if there were a better
> > way to handle arrays of types.  From looking in the catalog, it
> > appears that for each type, there is also declared a similar type,
> > which is the array version.  It seems that arrays should be considered
> > more flags on a field, than a field type in themselves.  Does this
> > make sense to anybody else?
>
> Is an array the same thing as a scalar?
Uhm, I don't believe so.

> What would be the benefit of making arrays "flags on a field" instead of
> a "field type in themselves". Seriously, how would this improve _anything_?

In particular, I was thinking of the PostgreSQL module for Python.  It
has a nice interface, but needs intimate knowledge of the data types.
Somehow, it seems to be excessively kludgy to have to have e.g. an
int4 type, and an int4[] type.  When I query a table, if one of the
fields is an array of integers, then I either want to know that it's
an array, or it's integer.  If the returned type is "array," then I
have to magically know that the array is filled with integers.  If
it's an integer, then I just have to recognize that it's actually a
series of integers.  With the current setup, there has to be separate
type handlers for char(2), char(2)[], int4, int4[], int2, int2[],
float8, float8[], etcetera.  I'd rather have handlers for the base
type, and an iterator that's used for arrays.

> What is the motivation for data type removal?

In this case, I don't want to *remove* the data type, just change the
identification method.  An array of int4 should really be recognized
as both (type)int4 and (type)array.  Urhm, since this is PostgreSQL, I
guess I'm arguing for type composition (how appropriate for an
object-relational database).

- --
=====================================================================
| JAVA must have been developed in the wilds of West Virginia.      |
| After all, why else would it support only single inheritance??    |
=====================================================================
| Finger geek@andrew.cmu.edu for my public key.                     |
=====================================================================

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQBVAwUBNRgR1YdzVnzma+gdAQFGVgH+PX4jvMZfhFK1ZzVdYuL844gCrg5ZleDt
T4x2b6TbOOqNGn7SZVQtpuCZXG7lSDFMNDRan2ft0OmE9ZlJ69ZpkA==
=q92I
-----END PGP SIGNATURE-----


pgsql-hackers by date:

Previous
From: dg@illustra.com (David Gould)
Date:
Subject: Re: [HACKERS] Data type removal
Next
From: darrenk@insightdist.com (Darren King)
Date:
Subject: Re: [HACKERS] Data type removal