Results 1 to 6 of 6
  1. #1
    Join Date
    May 2003
    Location
    Tampa, Florida
    Posts
    13

    Unanswered: selecting tables from multiple database

    How can i select table from multiple database in postgres.


    In Sqlserver it is like

    SELECT col1 FROM db1..tb1

    It doesn't work for Postgressql. Can someone help on this for me.

    Thanks
    Shriyan
    *********

  2. #2
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Arrow Just look

    It depends of your platform , if u use linux u can pipe a two queries with the shell, if you're using ODBC , u can create two ODBC DSN , then slelect from multilpe databases.

  3. #3
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    dblink

    there exists a project called dblink

    with this it is possible to select from multiple databases
    I think its in contrib

    there will be a java-framework for this from which you can connect with dblink through jdbc to any jdbc-connectable database

    I think this will fit your needs
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  4. #4
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Smile View

    I think that the best solution for your problem is just to create a view or many view than make a multi-select from views !

    from the Pgsql FAQ :
    4.24) How do I perform queries using multiple databases?

    There is no way to query a database other than the current one.
    Because PostgreSQL loads database-specific system catalogs, it is
    uncertain how a cross-database query should even behave.

    contrib/dblink allows cross-database queries using function calls. Of
    course, a client can make simultaneous connections to different
    databases and merge the results on the client side.
    Last edited by karim2k; 05-13-03 at 07:16.

  5. #5
    Join Date
    Mar 2005
    Posts
    2
    Hello

    I'm using Postgre and I'm trying to do some cross-db SELECT query.

    I wrote the following:
    SELECT * from catalogo.public.asse_elemento A
    INNER JOIN theasurus.public.termine T
    ON A.id_termine = T.id_row
    WHERE T.nome_termine = "graphi design"

    An I got this result:

    ERROR: cross-database references are not implemented: "theasurus.public.termine"

    I'm usign PGADMIN III v1.2 on a PostgreSQL v8.0.1 installed on a Mac.

    Thanks for your time,

  6. #6
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    dblink

    cross databaase queries are not native in postgresql at this time

    you must add the module dblink which is in the source tree under contrib

    there is also a readme file
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •