pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: yoursoft <yoursoft@freemail.hu>
Cc: Postgres JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: PreparedStatement vs. Statement problem
Date: Thu, 29 Nov 2007 22:39:39 +1300
Message-ID: <474E88DB.7030306@opencloud.com> (raw)
In-Reply-To: <474E87E9.3050609@freemail.hu>
References: <c752d6bd0711280650q53b3547ew7ea92ca45fd38d12@mail.gmail.com>
	<474E5E18.4080909@freemail.hu>
	<474E849F.3050603@opencloud.com>
	<474E87E9.3050609@freemail.hu>

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.

-O



view thread (4+ messages)  latest in thread

Message-ID: <474E88DB.7030306@opencloud.com>
Permalink:  ../474E88DB.7030306@opencloud.com/
Also on:    postgresql.org/message-id/474E88DB.7030306@opencloud.com

 · 

reply

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: oliver@opencloud.com, yoursoft@freemail.hu
  Subject: Re: PreparedStatement vs. Statement problem
  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>

* 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