And here's the WITH RECURSIVE version, which does not need the recursive
function, but will work only with Postgres 8.4 or above.
postgres=# with recursive roles(role_id) as
(select 4
union all
select parent_role_id
from a
You need a recursive lookup, and I guess 8.4's WITH RECURSIVE construct can
help here. But if you are on an older version of Postgres, you will have to
write recursive functions to do it.
I tried my hands on it, and attached is an implementation of such a
recursive function. It returns the expecte
Filip RembiaĆkowski schrieb:
2010/1/19 Andreas mailto:maps...@gmx.net>>
Hi,
I need something like the user-roles of PG to store options of my
users.
I guess i need a table with roles, options and one that stores the
refernces from roles to options.
roles (role_id, rol
2010/1/19 Andreas
> Hi,
>
> I need something like the user-roles of PG to store options of my users.
> I guess i need a table with roles, options and one that stores the
> refernces from roles to options.
>
> roles (role_id, role_name)
> option (option_id, option_name)
> role_has_option (role_fk,