Обсуждение: Possible new feature

Поиск
Список
Период
Сортировка

Possible new feature

От
mgould
Дата:
All,
 
I'm in the process of moving to PostGres from iAnywhere's SQL Anywhere v 10.  One of the neat features from ASA 10 is the ability to create "proxy tables"  These tables can be local or remote.  The purpose of a proxy table is that once create it can be used just like any other table or view.  You can use it in joins, subselects, etc.  ASA sees it as just a normal table.  The data can be stored in any ODBC compatible file system so it makes it easy to interact with all other database.  The synatx is pretty simple :
 

CREATE EXISTING TABLE [owner.]table-name
[ (column-definition, ...) ]
AT location-string

column-definition :
column-name data-type [NOT NULL]

location-string :
remote-server-name.[db-name].[owner].object-name
| remote-server-name;[db-name];[owner];object-name

example:

CREATE EXISTING TABLE blurbs
( author_id ID not null,
copy text not null)
AT 'server_a.db1.joe.blurbs';

 

Now you can acces blurbs just like any table.

 

Best Regards,

 

Michael Gould

All Coast Intermodal Services Inc.

 

 

 

Re: Possible new feature

От
"Alexander Staubo"
Дата:
On 7/30/07, mgould <mgould@allcoast.net> wrote:
> I'm in the process of moving to PostGres from iAnywhere's SQL Anywhere v 10.
>  One of the neat features from ASA 10 is the ability to create "proxy
> tables"  These tables can be local or remote.

Check out the dblink contrib module that comes with PostgreSQL. It
does the exact same thing, though without special syntax:

  create view foo as
  select * from dblink(
    'host=1.2.3.4 dbname=remotedb user=dbuser password=secretpass',
    'select id, title from foo')
    as remote_foo(id int, title text);

Alexander.