Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6FJfHa95888 for ; Sun, 15 Jul 2001 15:41:17 -0400 (EDT) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.1) with HTTP id 85953; Sun, 15 Jul 2001 12:41:15 -0700 From: "Josh Berkus" Subject: Re: Hey! ORDER BY in VIEWS? To: Peter Eisentraut Cc: pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.1 Date: Sun, 15 Jul 2001 12:41:15 -0700 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200107/187 X-Sequence-Number: 3982 Pater, Robbie, Bruce, > > Hey! I thought you couldn't do ORDER BY in views ... yet I just > did. > > Is this a new thing, or am I just getting my Trasact-SQL and my > > PostgreSQL mixed up again? > > I think it was allowed from 7.1 on to enable LIMIT in views to work > sensibly. Makes sense. I take it that this is a deviation from the ANSI 92 standard, then? What happens if I put an ORDER BY in a view, then call an ORDER BY in a query, e.g.: CREATE VIEW test_view AS SELECT client_name, city, zip FROM clients WHERE zip IS NOT NULL ORDER BY zip; SELECT * FROM test_view ORDER BY city; Does the second ORDER BY override or suppliment the view ORDER BY, or is it ignored? -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco