Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id CE7889FC04A for ; Tue, 7 Aug 2007 16:18:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 98313-06 for ; Tue, 7 Aug 2007 16:18:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id A2F7F9FC02C for ; Tue, 7 Aug 2007 16:18:06 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6FEF231440; Tue, 7 Aug 2007 21:18:05 +0200 (MET DST) From: Kev X-Newsgroups: pgsql.general Subject: Re: Using function like where clause Date: Tue, 07 Aug 2007 12:18:02 -0700 Organization: http://groups.google.com Lines: 26 Message-ID: <1186514282.434942.45940@m37g2000prh.googlegroups.com> References: <46B77A1D.4050908@wgsystems.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Complaints-To: groups-abuse@google.com In-Reply-To: <46B77A1D.4050908@wgsystems.com.br> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (BeOS; U; BeOS BePC; en-US; rv:1.9a1) Gecko/20061106 Minefield/3.0a1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m37g2000prh.googlegroups.com; posting-host=69.156.154.199; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 To: pgsql-general@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/487 X-Sequence-Number: 118336 On Aug 6, 3:44 pm, rmaz...@wgsystems.com.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