Custom types and arrays

Поиск
Список
Период
Сортировка
От mlunnon @ RWA
Тема Custom types and arrays
Дата
Msg-id 3FA2A61C.3010207@rwa-net.co.uk
обсуждение исходный текст
Ответы Re: Custom types and arrays
Список pgsql-general
Hi,<br /><br /> Does anyone know how to declare arrays of custom types?  The documentation says:<br /><br
/><blockquote>Asdiscussed earlier, PostgreSQL fully supports arrays of base types. Additionally, PostgreSQL supports
arraysof user-defined types as well. When you define a type, PostgreSQL automatically provides support for arrays of
thattype. For historical reasons, the array type has the same name as the user-defined type with the underscore
character_ prepended.<br /></blockquote> When I run the following code:<br /><br /> CREATE TYPE TEST_TYPE AS (<br />
   ID                    INTEGER,<br />     CODE                    VARCHAR(40)<br /> );<br /><br /> CREATE OR REPLACE
FUNCTIONTest1( ) RETURNS TEST_TYPE[20] AS'<br /> DECLARE<br />     aoTesttype TEST_TYPE[20];<br /> BEGIN<br />    
RETURNaoTestType;<br /> END;' LANGUAGE 'plpgsql';<br /><br /> CREATE OR REPLACE FUNCTION Test2( ) RETURNS _TEST_TYPE
AS'<br/> DECLARE<br />     aoTesttype _TEST_TYPE;<br /> BEGIN<br />     RETURN aoTestType;<br /> END;' LANGUAGE
'plpgsql';<br/><br /> I get:<br /> psql:Supplements.sql:34: ERROR:  Type "test_type[]" does not exist<br />
psql:Supplements.sql:41:ERROR:  Type "_test_type" does not exist<br /><br /> Can anyone help?<br /><br /> Thanks in
advance.<br/><br /> Matthew<br /> 

В списке pgsql-general по дате отправления:

Предыдущее
От: Lynn.Tilby@asu.edu
Дата:
Сообщение: Re: Recomended FS
Следующее
От: Shridhar Daithankar
Дата:
Сообщение: Re: retrieve statement from catalogs