Re: [SQL] usernames of a group from SQL

2006-05-21 Thread kijato
On Friday May 19 2006 12.04, Achilleus Mantzios wrote: > > SELECT u.usename from pg_user u,pg_group g where u.usesysid = any > (g.grolist) and g.groname='osztatlan_users'; > I'd like to make a function with this SQL: CREATE FUNCTION kodok.group_users(group_name "varchar") RETURNS SETOF "varchar"

Re: [SQL] usernames of a group from SQL

2006-05-21 Thread Markus Schaber
Hi, Kijato, kijato schrieb: > CREATE FUNCTION kodok.group_users(group_name "varchar") > RETURNS SETOF "varchar" AS > $BODY$ > SELECT pg_user.usename > FROM pg_user, pg_group > WHERE usesysid = any (pg_group.grolist) AND pg_group.groname=$1; > $BODY$ > LANGUAGE 'sql' VOLATILE; The pg_user.usernam

Re: [SQL] timestamp query doesn't use an index ...

2006-05-21 Thread Tom Lane
"Marc G. Fournier" <[EMAIL PROTECTED]> writes: > I'm trying to figure out some way to speed up the following query: >select ps2.page_id, ps2.template_component_id, max(ps2.start_time) > from page_schedule ps2 > where ps2.start_time at time zone 'MST7MDT' <= '2006-5-17 8:9:18' > group

Re: [SQL] timestamp query doesn't use an index ...

2006-05-21 Thread Marc G. Fournier
On Sun, 21 May 2006, Tom Lane wrote: "Marc G. Fournier" <[EMAIL PROTECTED]> writes: I'm trying to figure out some way to speed up the following query: select ps2.page_id, ps2.template_component_id, max(ps2.start_time) from page_schedule ps2 where ps2.start_time at time zone 'MST7

Re: [SQL] timestamp query doesn't use an index ...

2006-05-21 Thread Tom Lane
"Marc G. Fournier" <[EMAIL PROTECTED]> writes: > -> Bitmap Heap Scan on page_schedule ps2 (cost=573.65..2822.86 > rows=91614 width=16) (actual time=149.788..505.438 rows=94798 loops=1) > Recheck Cond: (timezone('MST7MDT'::text, start_time) <= '2006-05-17 > 08:09:18'::timestamp wit