Re: [SQL] Using function like where clause

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Ranieri Mazili <ranieri(dot)oliveira(at)terra(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Using function like where clause
Date: 2007-08-06 19:57:27
Message-ID: C7D5863E-42A0-4D38-972E-04EDF8ADD726@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql


On Aug 6, 2007, at 14:44 , Ranieri Mazili wrote:

> 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'

Probably. What have you tried? What does the documentation say? If
you're having trouble with a specific function, please provide the
code and hopefully we can work it out.

> 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'

Probably not. What have you tried? What does the documentation say?

A couple of minutes in psql would probably be faster than sending an
email to the list.

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-08-06 20:11:52 Re: 8.1.2 select for update issue
Previous Message Sergei Shelukhin 2007-08-06 19:53:31 finding out vacuum completion %, and vacuum VS vacuum full

Browse pgsql-sql by date

  From Date Subject
Next Message Ranieri Mazili 2007-08-07 13:41:03 Restricting columns by users
Previous Message Ranieri Mazili 2007-08-06 19:44:43 Using function like where clause