X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 68B429FB379 for ; Thu, 21 Sep 2006 19:48:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 65762-04 for ; Thu, 21 Sep 2006 19:48:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 3DAF49FB1E1 for ; Thu, 21 Sep 2006 19:48:26 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 032C630E31; Fri, 22 Sep 2006 00:48:25 +0200 (MET DST) From: MaXX X-Newsgroups: pgsql.sql Subject: Re: Help with optional parameters Date: Fri, 22 Sep 2006 00:48:14 +0200 Organization: Service de news de lacave.net Lines: 21 Message-ID: References: <031936836C46D611BB1B00508BE7345D04AD244C@gatekeeper.daycos.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@lacave.net User-Agent: Thunderbird 1.5.0.5 (X11/20060802) In-Reply-To: <031936836C46D611BB1B00508BE7345D04AD244C@gatekeeper.daycos.com> To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200609/151 X-Sequence-Number: 26362 Curtis Scheer wrote: > I noticed this one by searching in the archives, as I am working with some > "optional" parameters myself and noticed your solution. I just wanted to > make one improvement suggestion which is instead of checking whether or not > a parameter has been used simply start your query like so > Query_base := 'SELECT * FROM my_table WHERE 1 =1; > If you do that then you can just add on any parameters you need or not add > any at all. I think that seems to be a bit simpler than having a has_param" > Boolean variable. True, I think I was too focused on the "clean" output, your solution wastes less cycles and is more readable... Snipet updated, Thanks, -- MaXX