pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedSwitching from MySQL to PostgreSQL, JDBC drivers behaving differently
2+ messages / 2 participants
[nested] [flat]
* Switching from MySQL to PostgreSQL, JDBC drivers behaving differently
@ 2007-03-04 14:12 Matthias Karlsson <mc@kth.se>
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Karlsson @ 2007-03-04 14:12 UTC (permalink / raw)
To: pgsql-jdbc
Hi,
I originally had a much longer mail written describing in detail why I had a
problem with my current framework, but I decided to go with a simple
question instead :)
If I submit the following query to PostgreSQL:
select a.*, b.* from A a
inner join B b on b.id = a.b_id
where (for instance) both A and B have a column named 'name', is it possible
to distinguish between the two without using explicit positioning with the
JDBC interface? That is, with the MySQL driver, I can write:
rs.getString("a.name") and rs.getString("b.name"), but this doesn't seem to
work with PostgreSQL.
Sincerely,
Matthias Karlsson
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Switching from MySQL to PostgreSQL, JDBC drivers behaving differently
@ 2007-03-05 14:28 Dave Cramer <pg@fastcrypt.com>
parent: Matthias Karlsson <mc@kth.se>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Cramer @ 2007-03-05 14:28 UTC (permalink / raw)
To: Matthias Karlsson <mc@kth.se>; +Cc: pgsql-jdbc
Matthias,
On 4-Mar-07, at 9:12 AM, Matthias Karlsson wrote:
> Hi,
>
> I originally had a much longer mail written describing in detail
> why I had a
> problem with my current framework, but I decided to go with a simple
> question instead :)
>
> If I submit the following query to PostgreSQL:
>
> select a.*, b.* from A a
> inner join B b on b.id = a.b_id
>
> where (for instance) both A and B have a column named 'name', is it
> possible
> to distinguish between the two without using explicit positioning
> with the
> JDBC interface? That is, with the MySQL driver, I can write:
>
> rs.getString("a.name") and rs.getString("b.name"), but this doesn't
> seem to
> work with PostgreSQL.
That's correct it does not work with postgresql.
This is why hibernate,and other persistence layers explicitly name
their columns.
Dave
>
> Sincerely,
> Matthias Karlsson
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-03-05 14:28 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-03-04 14:12 Switching from MySQL to PostgreSQL, JDBC drivers behaving differently Matthias Karlsson <mc@kth.se>
2007-03-05 14:28 ` Dave Cramer <pg@fastcrypt.com>
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