pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedMigrate to Postgres - Alias a Keyword?
2+ messages / 2 participants
[nested] [flat]
* Migrate to Postgres - Alias a Keyword?
@ 2013-03-04 23:17 Huan Ruan <huan.ruan.it@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Huan Ruan @ 2013-03-04 23:17 UTC (permalink / raw)
To: pgsql-sql
Hi All
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?
Thanks
Huan
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Migrate to Postgres - Alias a Keyword?
@ 2013-03-05 13:45 Torsten Zuehlsdorff <foo@meisterderspiele.de>
parent: Huan Ruan <huan.ruan.it@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Torsten Zuehlsdorff @ 2013-03-05 13:45 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-03-05 13:45 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 23:17 Migrate to Postgres - Alias a Keyword? Huan Ruan <huan.ruan.it@gmail.com>
2013-03-05 13:45 ` Torsten Zuehlsdorff <foo@meisterderspiele.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox