X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9C9FC9DC833 for ; Sun, 5 Mar 2006 13:26:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60000-03 for ; Sun, 5 Mar 2006 13:26:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id A25E79DC800 for ; Sun, 5 Mar 2006 13:26:39 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k25HQapp083808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 5 Mar 2006 10:26:38 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id k25HQZar077985; Sun, 5 Mar 2006 10:26:35 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k25HQZYq077984; Sun, 5 Mar 2006 10:26:35 -0700 (MST) (envelope-from mfuhr) Date: Sun, 5 Mar 2006 10:26:35 -0700 From: Michael Fuhr To: sramsay@uga.edu Cc: pgsql-sql@postgresql.org Subject: Re: functions in WHERE clause Message-ID: <20060305172635.GA77911@winnie.fuhr.org> References: <20060305151652.GA14216@cantor.english.uga.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060305151652.GA14216@cantor.english.uga.edu> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.122 required=5 tests=[AWL=0.122] X-Spam-Score: 0.122 X-Spam-Level: X-Archive-Number: 200603/94 X-Sequence-Number: 24440 On Sun, Mar 05, 2006 at 10:16:52AM -0500, sramsay@uga.edu wrote: > I've got one of these: > > SELECT * from some_table WHERE > test_for_equality_is_syntactically_ugly; > > What I'd like to do is encapsulate the WHERE clause in a function, > but I'm having no end of trouble. Would a view work? If not then please provide a more concrete example that shows what you're trying to do. CREATE VIEW foo AS SELECT * FROM some_table WHERE test_for_equality_is_syntactically_ugly; -- Michael Fuhr