Re: [SQL] functions are returns columns

2007-11-10 Thread Michele Petrazzo - Unipex srl
Pavel Stehule wrote: CREATE FUNCTION getfoo(int) RETURNS foo AS $$ SELECT fooid, foosubid FROM foo WHERE fooid = $1 LIMIT 1; $$ LANGUAGE SQL; this return only one value, I need all the values that return the query or CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$ SELECT fooid,

[SQL] functions are returns columns

2007-11-09 Thread Michele Petrazzo - Unipex srl
Hi all. I want that a function return a table rows (like the doc says at 33.4.4. SQL Functions as Table Sources), but I want the a function return only a few cols, so the same that I select into the func. Modifying the doc example: CREATE TABLE foo (fooid int, foosubid int, fooname text); INSERT

[SQL] CIdr query qestion

2007-07-10 Thread Michele Petrazzo - Unipex srl
Hi ml! A question about cidr query. I'm tring to use the various cidr functions to exclude a A sub class, but I don't understand how use it: SELECT count(ip_addr), ip_addr from wi_log_network where ip_addr != network('10.10.0.0/16', 16) group by (ip_addr); it don't exclude the 10.10 ! Tried