From: tivvpgsqljdbc@gtech-ua.com
To: Oliver Jowett <oliver@opencloud.com>
Cc: yoursoft <yoursoft@freemail.hu>
Cc: Postgres JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: PreparedStatement vs. Statement problem
Date: Thu, 29 Nov 2007 12:18:48 +0200
Message-ID: <474E9208.8040605@gtech-ua.com> (raw)
In-Reply-To: <474E88DB.7030306@opencloud.com>
References: <c752d6bd0711280650q53b3547ew7ea92ca45fd38d12@mail.gmail.com>
<474E5E18.4080909@freemail.hu>
<474E849F.3050603@opencloud.com>
<474E87E9.3050609@freemail.hu>
<474E88DB.7030306@opencloud.com>
Oliver Jowett wrote:
> yoursoft wrote:
>> Ok, the planner uses different way. I think the planner use the UNION
>> in PreparedStatement and not the UNION ALL?
>> How to rewrite the SQL to use the UNION ALL in preparedstatement?
>
> You need an ORDER BY or the order is undefined and unpredictable. See
> http://www.postgresql.org/docs/8.2/static/queries-order.html
>
> There's no simple way to say "give me rows from this table first"
> other than running a query on each table separately.
Actually the simple way is
select c1,c2,c3,...,cn from (select 1, table1.* from table1 union all
select 2, table2.* from table2 union all ...) a(ordercolumn, c1, c2, c3,
.., cn) order by 1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tivvpgsqljdbc@gtech-ua.com, oliver@opencloud.com, yoursoft@freemail.hu
Subject: Re: PreparedStatement vs. Statement problem
In-Reply-To: <474E9208.8040605@gtech-ua.com>
References: <c752d6bd0711280650q53b3547ew7ea92ca45fd38d12@mail.gmail.com> <474E5E18.4080909@freemail.hu> <474E849F.3050603@opencloud.com> <474E87E9.3050609@freemail.hu> <474E88DB.7030306@opencloud.com> <474E9208.8040605@gtech-ua.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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