Re: Any Oracle HSODBC and PostgreSQL experience out there?

Lists: Postg롤 토토SQL : Postg롤 토토SQL 메일 링리스트 : 2006-04-19 이후 SFPUG 16:11
From: Reece Hart <reece(at)harts(dot)net>
To: SF PostgreSQL <sfpug(at)postgresql(dot)org>
Subject: Any Oracle HSODBC and PostgreSQL experience out there?
Date: 2006-04-12 23:22:32
Message-ID: 1144884152.31390.10.camel@tallac.gene.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 핫SQL : Postg토토 핫SQL 메일 링리스트 : 2006-04-12 이후 SFPUG 23:22

sfpuggers-

We're trying to make a postgresql db available within oracle using
hsodbc and dblinks. We're using oracle 9.2.0.5 on AIX, connecting to
postgresql 8.1.3 on x86_64-linux, using unixODBC and pgodbc (several
versions tried).

Has anyone out there made HSODBC work with PostgreSQL? If so, I'd
appreciate a config summary and we'll keep trying.

Among the issues we saw was that where clauses seem to be evaluated
locally, not remotely. So, a query like
SELECT * FROM schema(dot)table(at)database WHERE id=10
fetches all rows, then applies the where clause in Oracle. That's so
obviously unacceptable for large tables that there must be a better way,
but I've not seen any mention of this in groups and the two folks who've
done most of the configuration aren't aware of any alternatives. I'm
new to ODBC, but I can't believe that this is the intended behavior.

Are we missing something?

Thanks,
Reece

--
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0


From: elein <elein(at)varlena(dot)com>
To: Reece Hart <reece(at)harts(dot)net>
Cc: SF PostgreSQL <sfpug(at)postgresql(dot)org>
Subject: Re: Any Oracle HSODBC and PostgreSQL experience out there?
Date: 2006-04-13 19:16:43
Message-ID: 20060413191643.GX20430@varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: sfpug

On Wed, Apr 12, 2006 at 04:22:32PM -0700, Reece Hart wrote:
> sfpuggers-
>
> We're trying to make a postgresql db available within oracle using
> hsodbc and dblinks. We're using oracle 9.2.0.5 on AIX, connecting to
> postgresql 8.1.3 on x86_64-linux, using unixODBC and pgodbc (several
> versions tried).
>
> Has anyone out there made HSODBC work with PostgreSQL? If so, I'd
> appreciate a config summary and we'll keep trying.
>
> Among the issues we saw was that where clauses seem to be evaluated
> locally, not remotely. So, a query like
> SELECT * FROM schema(dot)table(at)database WHERE id=10
> fetches all rows, then applies the where clause in Oracle. That's so
> obviously unacceptable for large tables that there must be a better way,
> but I've not seen any mention of this in groups and the two folks who've
> done most of the configuration aren't aware of any alternatives. I'm
> new to ODBC, but I can't believe that this is the intended behavior.

This is also a problem with DBI-Link. Passing around the where clause
is a difficult thing to do. PostgreSQL doesn't make it available to
pass through a gateway (yet?) so I'm not surprised the ODBC has the same
issue. Disclaimer: I know nothing about HSODBC, but a have a good
general knowledge of gateways.

>
> Are we missing something?
>
> Thanks,
> Reece
>
> --
> Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
>


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: sfpug(at)postgresql(dot)org
Cc: Reece Hart <reece(at)harts(dot)net>
Subject: Re: Any Oracle HSODBC and PostgreSQL experience out there?
Date: 2006-04-13 23:03:53
Message-ID: 200604131603.53785.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토SQL : Postg토토SQL 메일 링리스트 : 2006-04-13 이후 SFPUG 23:03

Reece,

> We're trying to make a postgresql db available within oracle using
> hsodbc and dblinks. We're using oracle 9.2.0.5 on AIX, connecting to
> postgresql 8.1.3 on x86_64-linux, using unixODBC and pgodbc (several
> versions tried).
>
> Has anyone out there made HSODBC work with PostgreSQL? If so, I'd
> appreciate a config summary and we'll keep trying.

I think this is a problem with HSODBC and just about any gateway. You'd
have the same issues with MS Access or MS DTS.

You could hack this by extending DBI-Link, although the syntax will be
awkward ... currently RULES give us no way to grab the WHERE clause from
an incoming query. So you'd need to do something like:

SELECT * FROM select_oracle_table(ARRAY['col = value','col < value'])

or similar.

--
--Josh

Josh Berkus
PostgreSQL @ Sun
San Francisco


From: David Fetter <david(at)fetter(dot)org>
To: SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Re: Any Oracle HSODBC and PostgreSQL experience out there?
Date: 2006-04-13 23:17:03
Message-ID: 20060413231703.GE14809@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: sfpug

On Thu, Apr 13, 2006 at 04:03:53PM -0700, Josh Berkus wrote:
> Reece,
>
> > We're trying to make a postgresql db available within oracle using
> > hsodbc and dblinks. We're using oracle 9.2.0.5 on AIX, connecting to
> > postgresql 8.1.3 on x86_64-linux, using unixODBC and pgodbc (several
> > versions tried).
> >
> > Has anyone out there made HSODBC work with PostgreSQL? If so, I'd
> > appreciate a config summary and we'll keep trying.
>
> I think this is a problem with HSODBC and just about any gateway. You'd
> have the same issues with MS Access or MS DTS.
>
> You could hack this by extending DBI-Link, although the syntax will be
> awkward ... currently RULES give us no way to grab the WHERE clause from
> an incoming query. So you'd need to do something like:

I sent something out on this this morning, but it doesn't appear to
have gone through. DBI-Link has a facility called remote_query() that
lets you stuff a whole query over the wire. No automated
predicate-pushing just yet, but any help would be helpful. I suspect
that Major Back-End Engine Magick(TM) would be involved with automated
predicate-pushing.

Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!


From: Reece Hart <reece(at)harts(dot)net>
To: SF PostgreSQL <sfpug(at)postgresql(dot)org>
Subject: Re: Any Oracle HSODBC and PostgreSQL experience out there?
Date: 2006-04-19 00:43:11
Message-ID: 1145407391.31390.351.camel@tallac.gene.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: sfpug

Thanks Josh, Elein, David for replies.

On Thu, 2006-04-13 at 16:03 -0700, Josh Berkus wrote:

> You could hack this by extending DBI-Link, although the syntax will be
> awkward ... currently RULES give us no way to grab the WHERE clause
> from an incoming query. So you'd need to do something like:

Am I missing something? I'm trying to query a pg database from within
Oracle... DBI-Link doesn't help with going that direction, right?

I'm surprised at this outcome with HSODBC... I'm new to gateways but I
don't see how HSODBC is useful if you can't push predicates to the
remote side. I realize that this is is non-trivial, but in the
PostgreSQL world it seems like a Fetter Small Magic Plugin (TM) to a
cost-based optimizer might do the trick. Of course, that would not help
the poor sods like me who are occasionally trapped in Obfuscated,
Reprehensible, Arcane, and Crappy Legacy Environment.

-Reece

P.S. A colleague recently showed me
http://www.larsditzel.de/ora_arch.pdf and my response was simply "That's
why I use PostgreSQL".

--
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0


From: David Fetter <david(at)fetter(dot)org>
To: SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Re: Any Oracle HSODBC and PostgreSQL experience out there?
Date: 2006-04-19 13:53:33
Message-ID: 20060419135333.GA23146@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토SQL : Postg토토SQL 메일 링리스트 : 2006-04-19 이후 SFPUG 13:53

On Tue, Apr 18, 2006 at 05:43:11PM -0700, Reece Hart wrote:
> Thanks Josh, Elein, David for replies.
>
> On Thu, 2006-04-13 at 16:03 -0700, Josh Berkus wrote:
>
> > You could hack this by extending DBI-Link, although the syntax
> > will be awkward ... currently RULES give us no way to grab the
> > WHERE clause from an incoming query. So you'd need to do
> > something like:
>
> Am I missing something? I'm trying to query a pg database from
> within Oracle... DBI-Link doesn't help with going that direction,
> right?

It might, and here's a sketch of one way.

Let's say you have a set of tables in PostgreSQL that you want visible
from Oracle.

* Duplicate (or translate--this could be a little tricky) the
appropriate parts of their DDL on the Oracle side. Now there are
two sets of tables: one in PostgreSQL, the copy in Oracle.

* Hook up the Oracle set via DBI-Link in the same database as your
regular tables.

* Make some triggers on each table similar to the ones you'd use for
materialized views. The triggers would repeat INSERTs, UPDATEs and
DELETEs to the DBI-Link schema inside PostgreSQL. Ass-u-me'ing that
you have primary keys on each of those tables, you could automate
the trigger (function) creation process via using the information
schema.

* Do a bunch of INSERT INTO ... SELECT... on the with your PostgreSQL
tables as source and the DBI-Link views as destination to get
started.

> I'm surprised at this outcome with HSODBC... I'm new to gateways but I
> don't see how HSODBC is useful if you can't push predicates to the
> remote side. I realize that this is is non-trivial, but in the
> PostgreSQL world it seems like a Fetter Small Magic Plugin (TM) to a
> cost-based optimizer might do the trick.

I wish I were that smart. :)

Cheers,
D (pushing predicates from the PA)
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!


From: Reece Hart <reece(at)harts(dot)net>
To: David Fetter <david(at)fetter(dot)org>
Cc: SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Re: Any Oracle HSODBC and PostgreSQL experience out there?
Date: 2006-04-19 16:11:59
Message-ID: 1145463120.31390.379.camel@tallac.gene.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg롤 토토SQL : Postg롤 토토SQL 메일 링리스트 : 2006-04-19 이후 SFPUG 16:11

On Wed, 2006-04-19 at 06:53 -0700, David Fetter wrote:
> It might, and here's a sketch of one way...
[trigger+DBI link proposal snipped]

Hey, that's just crazy enough that it might work... perhaps we'll look
into that. Thanks for the tip!

-Reece

--
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0