dbTalk Databases Forums  

User-defined types

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss User-defined types in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jonathan Daugherty
 
Posts: n/a

Default User-defined types - 11-17-2004 , 12:30 PM






Hello,

I'm trying to write a PL/PgSQL function whose sole parameter is an
array whose element type is a type that I've created. For example:

CREATE TYPE test_type AS (x bigint, y bigint);

CREATE OR REPLACE FUNCTION array_test (test_type[]) ...

According to the 7.4 docs,

"Whenever a user-defined base data type is created, PostgreSQL
automatically creates an associated array type, whose name consists
of the base type's name prepended with an underscore. The parser
understands this naming convention, and translates requests for
columns of type foo[] into requests for type _foo. The
implicitly-created array type is variable length and uses the
built-in input and output functions array_in and array_out."

However,

mydb=# SELECT COUNT(*) FROM pg_type WHERE typname = '_test_type';
count
-------
0
(1 row)

Am I missing something? Thanks for your time.

I'm running PostgreSQL 7.4.5.

--
Jonathan Daugherty
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: User-defined types - 11-17-2004 , 01:09 PM






Jonathan Daugherty <cygnus (AT) cprogrammer (DOT) org> writes:
Quote:
I'm trying to write a PL/PgSQL function whose sole parameter is an
array whose element type is a type that I've created. For example:

According to the 7.4 docs,

"Whenever a user-defined base data type is created, PostgreSQL
automatically creates an associated array type, whose name consists
of the base type's name prepended with an underscore.
The key word in that sentence is "base" data type --- ie, not composite.
We don't currently support arrays of composite types. (Nor arrays of
domain types, either, IIRC.)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Reply With Quote
  #3  
Old   
Jonathan Daugherty
 
Posts: n/a

Default Re: User-defined types - 11-17-2004 , 01:10 PM



# > "Whenever a user-defined base data type is created, PostgreSQL
# > automatically creates an associated array type, whose name consists
# > of the base type's name prepended with an underscore.
#
# The key word in that sentence is "base" data type --- ie, not
# composite.

Ah, I see -- it wasn't obvious to me.

# We don't currently support arrays of composite types. (Nor arrays
# of domain types, either, IIRC.)

Ok, thanks for your time.

--
Jonathan Daugherty
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.