pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedGetting environment variables?
2+ messages / 2 participants
[nested] [flat]
* Getting environment variables?
@ 2000-01-13 02:25 mpg4@duluoz.net
0 siblings, 1 reply; 2+ messages in thread
From: mpg4@duluoz.net @ 2000-01-13 02:25 UTC (permalink / raw)
To: pgsql-sql
All-
I'd like to be able to create a view like this:
create view my_view as select * from real_table where check_cred(row.id)
where check_cred(row.id) is a function that checks for some externally
available credential or 'ticket' and only shows the rows in the table
that the id is allowed to see. Basically, I want to create 'virtual
users' inside of my database without creating a separate view for each
user. My problem is getting check_cred() to see the 'ticket' without
having it passed in with the query.
Environment variables won't workas the backend executes the query,
and doesn't have my environment. Some client/server thing would work,
I suppose, but I don't really want to code one if it can be avoided.
Is there an easier solution?
Also, is there a repository for user-created postgresql
types/functions anywhere? Some of the things I'm doing have to have
been done already, and done better.
Thanks,
-mike
--
And though the holes were rather small
They had to count them all
Now they know how many holes it takes to fill the Albert Hall
*I'd love to turn you on*
-- Beatles, "A Day in the Life"
GnuPG key available at http://devel.duluoz.net/pubkey.asc
Key ID = 1024D/9A256AE5 1999-11-13 Mike Glover <mpg4@duluoz.net>
Key fingerprint = EF6E 8BCB 4810 E98C F0FD 4596 367A 32B7 9A25 6AE5
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Getting environment variables?
@ 2000-01-16 17:13 Peter Eisentraut <peter_e@gmx.net>
parent: mpg4@duluoz.net
0 siblings, 0 replies; 2+ messages in thread
From: Peter Eisentraut @ 2000-01-16 17:13 UTC (permalink / raw)
To: mpg4@duluoz.net; +Cc: pgsql-sql
On 2000-01-12, mpg4@duluoz.net mentioned:
> I'd like to be able to create a view like this:
>
> create view my_view as select * from real_table where check_cred(row.id)
>
> where check_cred(row.id) is a function that checks for some externally
> available credential or 'ticket' and only shows the rows in the table
> that the id is allowed to see. Basically, I want to create 'virtual
> users' inside of my database without creating a separate view for each
> user. My problem is getting check_cred() to see the 'ticket' without
> having it passed in with the query.
I don't see this working out. Somehow you'd have to get the information on
the server host, there's no official way to abuse the PostgreSQL
connection for other purposes.
>
> Environment variables won't workas the backend executes the query,
> and doesn't have my environment. Some client/server thing would work,
> I suppose, but I don't really want to code one if it can be avoided.
> Is there an easier solution?
>
> Also, is there a repository for user-created postgresql
> types/functions anywhere? Some of the things I'm doing have to have
> been done already, and done better.
>
> Thanks,
>
> -mike
>
>
--
Peter Eisentraut Sernanders väg 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-01-16 17:13 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-01-13 02:25 Getting environment variables? mpg4@duluoz.net
2000-01-16 17:13 ` Peter Eisentraut <peter_e@gmx.net>
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