Re: Using function like where clause

From: Kev <kevinjamesfield(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using function like where clause
Date: 2007-08-07 19:18:02
Message-ID: 1186514282.434942.45940@m37g2000prh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Aug 6, 3:44 pm, rmaz(dot)(dot)(dot)(at)wgsystems(dot)com(dot)br (Ranieri Mazili) wrote:
> Hello,
>
> I have 2 questions.
> 1) Can I use a function that will return a string in a where clause like
> bellow?
>
> select *
> from table
> where my_function_making_where()
> and another_field = 'another_think'
>
> 2) Can I use a function that will return a string to return the list of
> columns that I want to show like below?
>
> select my_function_making_list_of_columns()
> from table
> where field_test = 'mydatum'
>
> Thanks

Look up the quote_ident() function in the docs, you'll likely need
that for both cases.

Kev

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tony Caduto 2007-08-07 19:28:20 Re: Reordering columns, will this ever be simple?
Previous Message Gregory Stark 2007-08-07 19:15:19 Re: Reordering columns, will this ever be simple?

Browse pgsql-sql by date

  From Date Subject
Next Message novice 2007-08-08 05:30:47 populate value of column
Previous Message Andrej Ricnik-Bay 2007-08-07 18:27:13 Re: [SQL] Restricting columns by users