pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedQuestion about PL/pgSQL
2+ messages / 2 participants
[nested] [flat]
* Question about PL/pgSQL
@ 2000-02-17 09:52 Vladimir Terziev <vlady@school.digsys.bg>
2000-02-17 12:26 ` Re: [SQL] Question about PL/pgSQL Kovacs Zoltan Sandor <tip@pc10.radnoti-szeged.sulinet.hu>
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Terziev @ 2000-02-17 09:52 UTC (permalink / raw)
To: pgsql-sql
Can anybody help me how to declare and use an text array in PL/pgSQL
Vladimir
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Question about PL/pgSQL
2000-02-17 09:52 Question about PL/pgSQL Vladimir Terziev <vlady@school.digsys.bg>
@ 2000-02-17 12:26 ` Kovacs Zoltan Sandor <tip@pc10.radnoti-szeged.sulinet.hu>
0 siblings, 0 replies; 2+ messages in thread
From: Kovacs Zoltan Sandor @ 2000-02-17 12:26 UTC (permalink / raw)
To: Vladimir Terziev <vlady@school.digsys.bg>; +Cc: pgsql-sql
> Can anybody help me how to declare and use an text array in PL/pgSQL
This plpgsql function answers the question whether a user (from
pg_shadow) is a member of the groups (pg_group), reading the array column
of pg_group. Unfortunately, I could not change any array item nor append
the array. I am afraid it is impossible, remembering Peter Eisentraut's
advice.
You might find something similar in contrib/array/.
Regards,
Zoltan
CREATE FUNCTION is_a_group_member (int4,varchar) RETURNS bool AS'
declare
rename $1 to userno;
rename $2 to group;
groupno integer;
listelement int4;
i integer;
b bool;
yesno bool;
begin
select into groupno grosysid from pg_group where group = groname;
if not found then
raise exception ''Non-existing group'';
end if;
i = 0; b = ''t''; yesno = ''f'';
while b loop
i = i + 1;
select into listelement pg_group.grolist[i]
from pg_group where groupno = grosysid;
if listelement is null then
b = ''f'';
end if;
if b and userno = listelement then
yesno = ''t'';
end if;
end loop;
return yesno;
end;
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-02-17 12:26 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-02-17 09:52 Question about PL/pgSQL Vladimir Terziev <vlady@school.digsys.bg>
2000-02-17 12:26 ` Kovacs Zoltan Sandor <tip@pc10.radnoti-szeged.sulinet.hu>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox