Re: Oracle Style packages on postgres
От | Thomas Hallgren |
---|---|
Тема | Re: Oracle Style packages on postgres |
Дата | |
Msg-id | thhal-0815cA1GfyicJ8zNpSue0JxA2rqxzGw@mailblocks.com обсуждение исходный текст |
Ответ на | Re: Oracle Style packages on postgres (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | pgsql-hackers |
Bruce Momjian wrote: >Thomas Hallgren wrote: > > >>Bruce Momjian wrote: >> >> >>>Josh Berkus wrote: >>> >>> >>> >>>>I think that private variables and private functions need to be part of the >>>>definition. >>>> >>>> >>>OK, so it seems we need: >>> >>> C static/private functions for schemas >>> C static/private variables for schemas >>> >>>Are private variables implemented via the temporary per-session schema? >>> >>> nested schemas >>> >>>What does the standard say? >>> >>> >>> >>The standard says that rather then using nested schemas or packages in >>conjunction with functions in order to group functions with data, use >>user defined types with attributes and methods. Methods can be STATIC, >>INSTANCE or CONSTRUCTOR. >> >> > >So it sounds like you group the functions into user-defined types, >rather than nested schemas. > Yes, you'd get <schema>.<type>.<method> as the fully qualified name. > So you assocate functions with a table? > > Not necessarily a table. A type is just a type. A type containing just static methods is not very different from an Oracle package. A table created from a type may of course have methods associated with it. That gets really interesting when you use INSTANCE methods. They act on a per row basis so that you can do things like: SELECT x.someMethod() FROM someTable x; rather than as today. SELECT someFunction(x) FROM someTable x; Regards, Thomas Hallgren
В списке pgsql-hackers по дате отправления: