Обсуждение: Schema access in PL/PGSQL for custom objects - i.e. type access?

Поиск
Список
Период
Сортировка

Schema access in PL/PGSQL for custom objects - i.e. type access?

От
"blay bloo"
Дата:
I was wondering how to access the schema of a type in PL/PGSQL

Basically, we've created some custom objects in the database, which
are somewhat similar to database/composite types (i.e. Create type..)-
essentially a named list of name/type pairs.

In PL/PGSQL you can define variables to be custom database types, but
when we try to do it with our custom objects we get:
ERROR: "myet is not a table"

Essentially we just want some way  to create a variable (type
instance, or even row) with the appropriate name/type pairs for OUR
objects in PL/PGSQL.

Where would we start looking to 'hack' the code for this - i.e.
how/where in pgsql can i either a) add my object to be recognised as a
'type' or b) make it seem the equivalent to a custom db type


Thanks
BB


Re: Schema access in PL/PGSQL for custom objects - i.e. type access?

От
Andrew Dunstan
Дата:
This appears to be a usage question. -hackers is about development of 
Postgres, not use. Please ask in the correct forum.

Also, when you do ask on the correct list, please add more detail to 
questions like this. In particular, show code that you have tried and 
that didn't work like you expected. Mailing list readers aren't 
mind-readers.

cheers

andrew

blay bloo wrote:
> I was wondering how to access the schema of a type in PL/PGSQL
>
> Basically, we've created some custom objects in the database, which
> are somewhat similar to database/composite types (i.e. Create type..)-
> essentially a named list of name/type pairs.
>
> In PL/PGSQL you can define variables to be custom database types, but
> when we try to do it with our custom objects we get:
> ERROR: "myet is not a table"
>
> Essentially we just want some way  to create a variable (type
> instance, or even row) with the appropriate name/type pairs for OUR
> objects in PL/PGSQL.
>
> Where would we start looking to 'hack' the code for this - i.e.
> how/where in pgsql can i either a) add my object to be recognised as a
> 'type' or b) make it seem the equivalent to a custom db type
>
>
> Thanks
> BB
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>
>   


Re: Schema access in PL/PGSQL for custom objects - i.e. type access?

От
Tom Lane
Дата:
"blay bloo" <blaybloo@googlemail.com> writes:
> I was wondering how to access the schema of a type in PL/PGSQL
> Basically, we've created some custom objects in the database, which
> are somewhat similar to database/composite types (i.e. Create type..)-
> essentially a named list of name/type pairs.

Is there a particularly good reason why you don't just use composite
types?  It sounds to me like you want to pile one hack atop another,
when you could avoid either by switching to the standard facility.
        regards, tom lane