pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Modular Type Libraries: was A real currency type
8+ messages / 6 participants
[nested] [flat]

* Modular Type Libraries: was A real currency type
@ 2006-03-22 02:40  Trent Shipley <tshipley@deru.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Trent Shipley @ 2006-03-22 02:40 UTC (permalink / raw)
  To: pgsql-hackers@postgresql.org

Without directly addressing the merits of enumerations, enumeration 
interfaces, real currency and time zone types, or whether currency and time 
zone types should be built using enumerations, I would like to ask the 
powers-that-be to seriously consider radically modularizing Postgresql's type 
system.

The core Postgresql installation would come with just those built-in types 
needed to bootstrap itself, perhaps just varchar and an integer type.  
Everything else would be a contributed module.

An interface or contract would be described for creating additional types.  It 
would include things like parameter handlers, how to dump the type, and how 
to load the type.  (That is, standard housekeeping functions needed by the 
Postgresql engine.)

Other that the tiny number of bootstrap types, Postgresql types would 
basically all be contrib modules.

Types could be bundled into groups such as binary, character, numerical, 
2d-spatial, networking, and so on.

Then one would not debate whether a type (or meta-type, like an enumeration) 
should be put into the core product.  Instead, the debate would be whether or 
not to grade the type as "mature" and whether or not to put a given type into 
pre-packaged type libraries with names like "legacy", "sql-2003-standard", or 
"recommended-default".

Power user DBA's could customize the types offered on their systems.

In short:

1) Types would be modular.  This would be elegant, but have no practical 
effect on database performance.    

2) The framework needed to support modular types would encourage type 
development.  This would enhance Postgresql's adaptability which would be A 
Very Good Thing.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Modular Type Libraries: was A real currency type
@ 2006-03-22 03:31  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Trent Shipley <tshipley@deru.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Tom Lane @ 2006-03-22 03:31 UTC (permalink / raw)
  To: tshipley@deru.com; +Cc: pgsql-hackers@postgresql.org

Trent Shipley <tshipley@deru.com> writes:
> Without directly addressing the merits of enumerations, enumeration 
> interfaces, real currency and time zone types, or whether currency and time 
> zone types should be built using enumerations, I would like to ask the 
> powers-that-be to seriously consider radically modularizing Postgresql's type
> system.

Er ... what makes you think it's not modular now?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Modular Type Libraries: was A real currency type
@ 2006-03-22 03:34  Andrew Dunstan <andrew@dunslane.net>
  parent: Trent Shipley <tshipley@deru.com>
  1 sibling, 2 replies; 8+ messages in thread

From: Andrew Dunstan @ 2006-03-22 03:34 UTC (permalink / raw)
  To: tshipley@deru.com; +Cc: pgsql-hackers@postgresql.org

Trent Shipley said:
> Without directly addressing the merits of enumerations, enumeration
> interfaces, real currency and time zone types, or whether currency and
> time  zone types should be built using enumerations, I would like to
> ask the  powers-that-be to seriously consider radically modularizing
> Postgresql's type  system.
>
> The core Postgresql installation would come with just those built-in
> types  needed to bootstrap itself, perhaps just varchar and an integer
> type.   Everything else would be a contributed module.
>
> An interface or contract would be described for creating additional
> types.  It  would include things like parameter handlers, how to dump
> the type, and how  to load the type.  (That is, standard housekeeping
> functions needed by the  Postgresql engine.)
>
> Other that the tiny number of bootstrap types, Postgresql types would
> basically all be contrib modules.
>
> Types could be bundled into groups such as binary, character,
> numerical,  2d-spatial, networking, and so on.
>
> Then one would not debate whether a type (or meta-type, like an
> enumeration)  should be put into the core product.  Instead, the debate
> would be whether or  not to grade the type as "mature" and whether or
> not to put a given type into  pre-packaged type libraries with names
> like "legacy", "sql-2003-standard", or  "recommended-default".
>
> Power user DBA's could customize the types offered on their systems.
>
> In short:
>
> 1) Types would be modular.  This would be elegant, but have no
> practical  effect on database performance.
>
> 2) The framework needed to support modular types would encourage type
> development.  This would enhance Postgresql's adaptability which would
> be A  Very Good Thing.

We already have good support of type development. It's not clear to me that
this would buy us anything at all. It seems like modularisation for the sake
of it. The real issue is what types and type mechanisms should be in the
postgresql core distribution. We won't win any thanks from anyone if we
reduce them. Getting some types right is hard. There is no case that I can
see for pushing timestamps, numerics, bitstrings or geometric or network
types out of the core - they need all the support they can get. I'm also not
sure which of these are required by the SQL spec.

cheers

andrew





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Modular Type Libraries: was A real currency type
@ 2006-03-22 03:37  Aftab Alam <aalam@tatashare.com>
  parent: Andrew Dunstan <andrew@dunslane.net>
  1 sibling, 0 replies; 8+ messages in thread

From: Aftab Alam @ 2006-03-22 03:37 UTC (permalink / raw)
  To: 'Andrew Dunstan' <andrew@dunslane.net>; tshipley@deru.com; +Cc: pgsql-hackers@postgresql.org

remove my email from the list

Regards,





-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of Andrew Dunstan
Sent: Wednesday, March 22, 2006 9:05 AM
To: tshipley@deru.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Modular Type Libraries: was A real currency type


Trent Shipley said:
> Without directly addressing the merits of enumerations, enumeration
> interfaces, real currency and time zone types, or whether currency and
> time  zone types should be built using enumerations, I would like to
> ask the  powers-that-be to seriously consider radically modularizing
> Postgresql's type  system.
>
> The core Postgresql installation would come with just those built-in
> types  needed to bootstrap itself, perhaps just varchar and an integer
> type.   Everything else would be a contributed module.
>
> An interface or contract would be described for creating additional
> types.  It  would include things like parameter handlers, how to dump
> the type, and how  to load the type.  (That is, standard housekeeping
> functions needed by the  Postgresql engine.)
>
> Other that the tiny number of bootstrap types, Postgresql types would
> basically all be contrib modules.
>
> Types could be bundled into groups such as binary, character,
> numerical,  2d-spatial, networking, and so on.
>
> Then one would not debate whether a type (or meta-type, like an
> enumeration)  should be put into the core product.  Instead, the debate
> would be whether or  not to grade the type as "mature" and whether or
> not to put a given type into  pre-packaged type libraries with names
> like "legacy", "sql-2003-standard", or  "recommended-default".
>
> Power user DBA's could customize the types offered on their systems.
>
> In short:
>
> 1) Types would be modular.  This would be elegant, but have no
> practical  effect on database performance.
>
> 2) The framework needed to support modular types would encourage type
> development.  This would enhance Postgresql's adaptability which would
> be A  Very Good Thing.

We already have good support of type development. It's not clear to me that
this would buy us anything at all. It seems like modularisation for the sake
of it. The real issue is what types and type mechanisms should be in the
postgresql core distribution. We won't win any thanks from anyone if we
reduce them. Getting some types right is hard. There is no case that I can
see for pushing timestamps, numerics, bitstrings or geometric or network
types out of the core - they need all the support they can get. I'm also not
sure which of these are required by the SQL spec.

cheers

andrew



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

               http://archives.postgresql.org




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Modular Type Libraries: was A real currency type
@ 2006-03-22 03:39  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Andrew Dunstan <andrew@dunslane.net>
  1 sibling, 2 replies; 8+ messages in thread

From: Tom Lane @ 2006-03-22 03:39 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: tshipley@deru.com; pgsql-hackers@postgresql.org

"Andrew Dunstan" <andrew@dunslane.net> writes:
> ... The real issue is what types and type mechanisms should be in the
> postgresql core distribution. We won't win any thanks from anyone if we
> reduce them. Getting some types right is hard. There is no case that I can
> see for pushing timestamps, numerics, bitstrings or geometric or network
> types out of the core - they need all the support they can get. I'm also not
> sure which of these are required by the SQL spec.

Timestamps and numerics are definitely in the spec, geometric and
network types are definitely not.  IIRC, bitstring types are in SQL99
but for some reason are deprecated in SQL2003 (if anyone knows the
reasoning behind the SQL committee's about-face on that, please clue
us in).

AFAICS, the main part of the type system that isn't modular is the
support for type parameters (a/k/a typmod), such as the maximum length
for varchar or the precision/scale for numeric.  We could certainly
invent an API for interpreting such parameters.  But in the current state
of the system the types that have such parameters have to be hard-wired
into the SQL grammar, and I don't see how to get rid of that hard-wiring
without breaking a whole lot of stuff.  Any bison gurus hanging about?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Modular Type Libraries: was A real currency type
@ 2006-03-22 09:17  Martijn van Oosterhout <kleptog@svana.org>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 8+ messages in thread

From: Martijn van Oosterhout @ 2006-03-22 09:17 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Dunstan <andrew@dunslane.net>; tshipley@deru.com; pgsql-hackers@postgresql.org

On Tue, Mar 21, 2006 at 10:39:03PM -0500, Tom Lane wrote:
> AFAICS, the main part of the type system that isn't modular is the
> support for type parameters (a/k/a typmod), such as the maximum length
> for varchar or the precision/scale for numeric.  We could certainly
> invent an API for interpreting such parameters.  But in the current state
> of the system the types that have such parameters have to be hard-wired
> into the SQL grammar, and I don't see how to get rid of that hard-wiring
> without breaking a whole lot of stuff.  Any bison gurus hanging about?

We've been here before:

http://archives.postgresql.org/pgsql-hackers/2005-08/msg01142.php

Turns out it isn't too hard, except there are a number of limitations.
Unfortunatly I seem to have the deleted the patch I created then. :(

Summerising the thread then:

- It made some changes to what was and wasn't a reserved word.
- Character sets for CHAR types still fall outside the system.
- Some other changes in behaviour

I'm not sure if much has changed since that discussion.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachments:

  signature.asc (application/pgp-signature, 188B) download

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Modular Type Libraries: was A real currency type
@ 2006-03-22 15:53  William ZHANG <uniware@zedware.org>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 8+ messages in thread

From: William ZHANG @ 2006-03-22 15:53 UTC (permalink / raw)
  To: pgsql-hackers@postgresql.org


"Tom Lane" <tgl@sss.pgh.pa.us>
> Timestamps and numerics are definitely in the spec, geometric and
> network types are definitely not.  IIRC, bitstring types are in SQL99
> but for some reason are deprecated in SQL2003 (if anyone knows the
> reasoning behind the SQL committee's about-face on that, please clue
> us in).

There is a standard data type called "BIT" in ODBC and JDBC,
but it is sth. like SQL standard's BOOLEAN, not BIT. It seems that
some DBMSs implement BIT as BOOLEAN in the backend. Maybe the standard
committee think that bit string is useless and easy to cause confusion?

Regards,
William ZHANG





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Modular Type Libraries: was A real currency type
@ 2006-03-23 00:39  Trent Shipley <tshipley@deru.com>
  parent: William ZHANG <uniware@zedware.org>
  0 siblings, 0 replies; 8+ messages in thread

From: Trent Shipley @ 2006-03-23 00:39 UTC (permalink / raw)
  To: pgsql-hackers@postgresql.org

On Wednesday 2006-03-22 08:53, William ZHANG wrote:
> "Tom Lane" <tgl@sss.pgh.pa.us>
>
> > Timestamps and numerics are definitely in the spec, geometric and
> > network types are definitely not.  IIRC, bitstring types are in SQL99
> > but for some reason are deprecated in SQL2003 (if anyone knows the
> > reasoning behind the SQL committee's about-face on that, please clue
> > us in).
>
> There is a standard data type called "BIT" in ODBC and JDBC,
> but it is sth. like SQL standard's BOOLEAN, not BIT. It seems that
> some DBMSs implement BIT as BOOLEAN in the backend. Maybe the standard
> committee think that bit string is useless and easy to cause confusion?

In or out of the standard, bitstring can be a nice type to have.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2006-03-23 00:39 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-03-22 02:40 Modular Type Libraries: was A real currency type Trent Shipley <tshipley@deru.com>
2006-03-22 03:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-03-22 03:34 ` Andrew Dunstan <andrew@dunslane.net>
2006-03-22 03:37   ` Aftab Alam <aalam@tatashare.com>
2006-03-22 03:39   ` Tom Lane <tgl@sss.pgh.pa.us>
2006-03-22 09:17     ` Martijn van Oosterhout <kleptog@svana.org>
2006-03-22 15:53     ` William ZHANG <uniware@zedware.org>
2006-03-23 00:39       ` Trent Shipley <tshipley@deru.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox