On 3/26/10 5:42 AM +0200, Joseph Adams wrote:
> // New libpq function
> pg_set('current_user', 'bob');
>
> $result = pg_query_params(
> 'SELECT answer FROM secrets WHERE user=current_user AND question=$1',
> array('Birth place'));
>
>
> What this really does is something like:
>
> $result = pg_query_params(
> 'LET current_user=$1 DO $2 $3',
> array(
> 'bob',
> 'SELECT answer FROM secrets WHERE user=current_user AND question=$1',
> 'Birth place')
> ));
Looks to me like this is already achievable with custom GUCs and views.
Regards,
Marko Tiikkaja