X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 950F85646C for ; Wed, 16 Mar 2005 15:13:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05109-07 for ; Wed, 16 Mar 2005 15:13:23 +0000 (GMT) Received: from ns.aprote.ee (ns.aprote.ee [80.235.78.106]) by svr1.postgresql.org (Postfix) with ESMTP id 6950C56994 for ; Wed, 16 Mar 2005 15:13:18 +0000 (GMT) Received: Message by Barricade ns.aprote.ee with ESMTP id j2GFECb6003182 for ; Wed, 16 Mar 2005 17:14:12 +0200 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0 Subject: Re: Parameterized views proposition Date: Wed, 16 Mar 2005 17:13:22 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] Parameterized views proposition Thread-Index: AcUpbslWvFjxRbmVR82PQqeFqbuVfwAyRUtA From: "Tambet Matiisen" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/229 X-Sequence-Number: 20708 =20 >=20 > "Tambet Matiisen" writes: > > How tough it would be to implement >=20 > > CREATE VIEW xxx PARAMETERS (yyy) AS zzz; >=20 > > as >=20 > > CREATE TYPE xxx; > > CREATE FUNCTION xxx(yyy) RETURNING SETOF xxx LANGUAGE sql AS 'zzz'; >=20 > What's the point? It'd be nonstandard anyway, so just use=20 > the function. >=20 > regards, tom lane >=20 1. Cleaner syntax. 2. No possible inconsistencies between return type and query result. 3. No strange quoting, like '' and $$. 4. Just to save some keystrokes. Another issue, that has to be handled separately: 5. Show up in EXPLAIN as normal query, not function scan. About standards - maybe it's time to set some standard? :) Now seriously, maybe it's really not right to call it a parameterized view. Maybe instead CREATE FUNCTION syntax could be improved somehow, so that you don't have to CREATE TYPE separately. Tambet