Help on extensended attribute types?
От | Mike Meyer |
---|---|
Тема | Help on extensended attribute types? |
Дата | |
Msg-id | Pine.BSF.4.05.9810260018240.28264-100000@guru.phone.net обсуждение исходный текст |
Список | pgsql-sql |
Having waded through the manuals, and the man pages, and the regression tests, and the mail archives - I've still got questions about the "array" and set/composite/complex attributes. It appears that this question comes up farily regularly, and generally gets little/no discussion (not always, but generally). Would someone verify my conclusions about these things: 1) There is no way to add elements to an attribute of array type. 2) There is now ay to find out how large an array is (?). This limits their usefullness to things that are either always the same size, or are static. Counterexamples greatly appreciated. Second, the so-called "set" attribute type. Either I've missed something completely, or this draws from an example on the create_table man page that says create table newemp (name text, manager newemp) This doesn't work in 6.3.2 - the type "newemp" isn't found. You can create this table by doing an alter table, and adding the manager attribute afer the fact. From the mail list archives, I discovered that I can create a function to set the manager attribute, something like so: create function find_newemp(name) returns newemp as 'select * from newmp where name = $1' language 'sql' And sure enough, doing things like update newemp set manager = find_newemp('somename') starts filling in the manager column. But - here's the critical issue - what can I do with these attributes now? I vaguelly recall seeing a referecne to attribute names as functions names, but attempts to do something like: select name, name(manager) from newemp or select name, newemp.manager.name from newemp all generate error messages of some kid or another. So - can anyone show me how to use these features? Thanx, <mike
В списке pgsql-sql по дате отправления: