possible DOMAIN implementation
От | Horák Daniel |
---|---|
Тема | possible DOMAIN implementation |
Дата | |
Msg-id | 9C8918CC8CDAAC4AA79D4594A480648901E68C2B@EXCHANGE.mmp.plzen-city.cz обсуждение исходный текст |
Ответы |
Re: possible DOMAIN implementation
|
Список | pgsql-hackers |
Hello, I have spend some thinking about implementation of DOMAIN capability. Here are my ideas. What is a domain? It is an alias for a type with size, constraints and default values. It is like one column of a table. And this is the main idea of my "implementation". It should be possible to implement it using existing system tables. New rules for grammar can be easily created from already existing pieces (column definition of a table). How to store information about a domain in system tables? When a new domain is created it will: - put a record into pg_type with typnam = domain name, new code for typtype = 'd' and typrelid = oid of a new record in pg_class (next line) - put a record into pg_class to create a fictional table with a new relkind ('d'?), relnatts = 1, relname can be system generated (pg_d_<domainname>) - put a records into pg_attribute and pg_attrdef with "column (attribute) definition" - real type, size, default value etc., owner will the fictional table from the previous step Then it will be required to modify functions that works with types. When typtype of a retrieved type is 'd' then it will perform lookups into pg_class, pg_attribute and pg_attrdef to find the real definition of the domain. These additional lookups will also create a performace penalty of using domains. But every feature has its costs. I know this paragraph about the real implementation is very short, but I think there are people that know the "type mechanism" better then I know. And can easier tell if it is possible to go this way. I hope you understand my explanation. It is also possible that I don't know some aspects of the backend code that makes my idea wrong. Dan ---------------------------------------------- Ing. Daniel Horak network and system administrator e-mail: horak@sit.plzen-city.cz privat e-mail: dan.horak@email.cz ICQ:36448176 ----------------------------------------------
В списке pgsql-hackers по дате отправления: