Re:

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Max <xdmaxx(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re:
Date: 2006-08-15 16:27:57
Message-ID: 1155659277.11726.98.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2006-08-15 at 18:05 +0200, Max wrote:

> Do you know if it is possible to write such things :
>
> SELECT * FROM tablename WHERE permission(some parameters) == TRUE;
>
> with the function 'permission' returning TRUE or FALSE after a check
> on different perm_fields of the current row.

Yes, you can do that. The best place to start is:

http://www.postgresql.org/docs/8.1/static/plpgsql.html

You want to create a pretty basic function that returns "boolean" and
takes a few parameters. Note that SQL does not have the C-style "=="
equality test. In SQL just write "= true". Better yet, since your
function returns boolean just do "WHERE permission(...)" with "..."
replaced by your parameters.

If you have trouble after trying out some examples at that link, post
back to the list with what you tried.

Regards,
Jeff Davis

In response to

  • at 2006-08-15 16:05:36 from Max

Responses

  • Re: at 2006-08-15 16:46:18 from Max

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2006-08-15 16:38:34 Re: Unable to Start PostgreSQL 8.1.4 on Windows XP
Previous Message Jeff Davis 2006-08-15 16:21:00 Re: Partial indexes Vs standard indexes : Insert