[postgis-devel] Re: [postgis-users] create tables smarter

Paul Ramsey pramsey at cleverelephant.ca
Wed Jun 4 09:56:24 PDT 2008


Very cool. Interesting limitation though:

"The optional type_modifier_input_function and
type_modifier_output_function are needed if the type supports
modifiers, that is optional constraints attached to a type
declaration, such as char(5) or numeric(30,2). PostgreSQL allows
user-defined types to take one or more simple constants or identifiers
as modifiers. However, this information must be capable of being
packed into a single non-negative integer value for storage in the
system catalogs"

Could make support for srid values tricky, to say the least...
currently it looks like we can do it, but it would requires some
constraining of spatial_ref_sys.

test=# select max(srid) from spatial_ref_sys;
  max
-------
 32766
(1 row)


Fun!!!!

P

On Wed, Jun 4, 2008 at 8:57 AM, Markus Schaber <schabi at logix-tt.com> wrote:
> Hi, Paul,
>
> "Paul Ramsey" <pramsey at cleverelephant.ca> wrote:
>
>> On Wed, Jun 4, 2008 at 8:34 AM, Frank Warmerdam <warmerdam at pobox.com> wrote:
>> > I did a presentation at PGCon and the issue of AddGeometryColumn() being
>> > necessary to populate the geometry_columns table came up.  Some of the
>> > postgres techies suggested there has been work so that extension defined
>> > types could actually take extra arguments when used in the CREATE TABLE
>> > statement and that this might let us avoid the need to use
>> > AddGeometryColumn().
>> >
>> > ie.
>> >
>> > CREATE TABLE ROADS
>> >  (id   INT,
>> >   name VARCHAR(255),
>> >   geom GEOMETRY(<dimension>,<srid>,<type>) )
>>
>> Really truly? This is something we've been asking for, for some time,
>> but I wasn't really holding my breath. Time to go code spelunking and
>> see if it's there.
>
> At least the Developer Dokumentation of PostgreSQL 8.4 mentions it:
>
> http://developer.postgresql.org/pgdocs/postgres/sql-createtype.html
>
> Search for "typmod".
>
> I did not yet look whether older versions like 8.3 provide it, or 8.4
> is the first.
>
>
> Regards,
> Markus
>
> --
> Markus Schaber | Logical Tracking&Tracing International AG
> Dipl. Inf.     | Software Development GIS
>
> Fight against software patents in Europe! www.ffii.org
> www.nosoftwarepatents.org
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>



More information about the postgis-devel mailing list