⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 query

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻
字号:
==================================================================Namedblink -- Returns a set from a remote databaseSynopsisdblink(text connstr, text sql [, bool fail_on_error])dblink(text connname, text sql [, bool fail_on_error])dblink(text sql [, bool fail_on_error])Inputs  connname  connstr    If two arguments are present, the first is first assumed to be a specific    connection name to use. If the name is not found, the argument is then    assumed to be a valid connection string, of standard libpq format,    e.g.: "hostaddr=127.0.0.1 dbname=mydb user=postgres password=mypasswd"    If only one argument is used, then the unnamed connection is used.  sql    sql statement that you wish to execute on the remote host    e.g. "select * from pg_class"  fail_on_error    If true (default when not present) then an ERROR thrown on the remote side    of the connection causes an ERROR to also be thrown locally. If false, the    remote ERROR is locally treated as a NOTICE, and no rows are returned.Outputs  Returns setof recordExample usageselect * from dblink('dbname=postgres','select proname, prosrc from pg_proc') as t1(proname name, prosrc text) where proname like 'bytea%';  proname   |   prosrc------------+------------ byteacat   | byteacat byteaeq    | byteaeq bytealt    | bytealt byteale    | byteale byteagt    | byteagt byteage    | byteage byteane    | byteane byteacmp   | byteacmp bytealike  | bytealike byteanlike | byteanlike byteain    | byteain byteaout   | byteaout(12 rows)select dblink_connect('dbname=postgres'); dblink_connect---------------- OK(1 row)select * from dblink('select proname, prosrc from pg_proc') as t1(proname name, prosrc text) where proname like 'bytea%';  proname   |   prosrc------------+------------ byteacat   | byteacat byteaeq    | byteaeq bytealt    | bytealt byteale    | byteale byteagt    | byteagt byteage    | byteage byteane    | byteane byteacmp   | byteacmp bytealike  | bytealike byteanlike | byteanlike byteain    | byteain byteaout   | byteaout(12 rows)select dblink_connect('myconn','dbname=regression'); dblink_connect---------------- OK(1 row)select * from dblink('myconn','select proname, prosrc from pg_proc') as t1(proname name, prosrc text) where proname like 'bytea%';  proname   |   prosrc------------+------------ bytearecv  | bytearecv byteasend  | byteasend byteale    | byteale byteagt    | byteagt byteage    | byteage byteane    | byteane byteacmp   | byteacmp bytealike  | bytealike byteanlike | byteanlike byteacat   | byteacat byteaeq    | byteaeq bytealt    | bytealt byteain    | byteain byteaout   | byteaout(14 rows)==================================================================A more convenient way to use dblink may be to create a view: create view myremote_pg_proc as select * from dblink('dbname=postgres','select proname, prosrc from pg_proc') as t1(proname name, prosrc text);Then you can simply write:   select * from myremote_pg_proc where proname like 'bytea%';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -