Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UCsX9-00079s-Db for pgsql-sql@arkaria.postgresql.org; Tue, 05 Mar 2013 14:07:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UCsX8-0001KP-A8 for pgsql-sql@arkaria.postgresql.org; Tue, 05 Mar 2013 14:07:58 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UCsWh-00011H-N9 for pgsql-sql@postgresql.org; Tue, 05 Mar 2013 14:07:31 +0000 Received: from news.hub.org ([200.46.204.72]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UCsWf-00071D-A2 for pgsql-sql@postgresql.org; Tue, 05 Mar 2013 14:07:31 +0000 Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.5/8.14.5) with ESMTP id r25E7SEE004321 for ; Tue, 5 Mar 2013 10:07:28 -0400 (AST) (envelope-from news@news.hub.org) Received: from news.hub.org (news@localhost) by news.hub.org (8.14.5/8.14.5/Submit) with NNTP id r25DjkpR095328 for pgsql-sql@postgresql.org; Tue, 5 Mar 2013 09:45:46 -0400 (AST) (envelope-from news) From: Torsten Zuehlsdorff X-Newsgroups: pgsql.sql Subject: Re: Migrate to Postgres - Alias a Keyword? Date: Tue, 05 Mar 2013 14:45:44 +0100 Organization: A noiseless patient Spider Message-ID: <5135F708.4070100@meisterderspiele.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: mx05.eternal-september.org; posting-host="a9a5a40fb25f632985851d0b6191ba19"; logging-data="12185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/YEMCxqWqJSifeH/brAKuQ" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130220 Thunderbird/17.0.3 In-Reply-To: Cancel-Lock: sha1:qsVQkltyjPCLuzVAjiUatjKmFHY= To: pgsql-sql@postgresql.org X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Hi, > We are migrating from Firebird to Postgres. We try to minimise changes > required to the application code which has lots of SQLs in it. One of > the incompatibilities between these two is the way to limit the number > of rows returned by a SELECT query. > > In Postgres, /SELECT * FROM TestTable LIMIT 10/ > In Firebird, /SELECT * FROM TestTable ROWS 10/ > > What I'm trying to do here is to get Postgres to accept ROWS as if it's > LIMIT. Looks like this is possible by adding an alias > in /src/include/parser/kwlist.h, although ROWS is already defined in it > for other purpose. > > Does anyone has a suggestion on this? Can I achieve this without > recompiling our own copy of Postgres? i would hack the application, if there is database-layer in. For problems like this i created the DDDBL (PHP, documentation in german, sorry). It is a layer between application and database with full controll over the queries and their result. This is exactly the point to manipulate the SQL. There are many pitfalls - like LIMIT as part of a relation, constant, etc - but it will work. Greetings from Germany, Torsten -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql