PostgreSQL - 如果两个表具有相同的no.of列且具有相同的数据类型,我们可以在另一个模式函数中使用一个模式表

时间:2017-04-11 12:14:21

标签: postgresql

PostgreSQL

如果两个表具有相同的no.of列且具有相同的数据类型,我们是否可以在另一个模式函数中使用一个模式表

1 个答案:

答案 0 :(得分:0)

示例:

t=# create schema so51;
CREATE SCHEMA
t=# create schema so52;
CREATE SCHEMA
t=# create table so51.so53(i int);
CREATE TABLE
t=# create function so52.so54() returns int as $$begin return coalesce((select i from so51.so53),42); end;$$ language plpgsql;
CREATE FUNCTION
t=# select so52.so54();
 so54
------
   42
(1 row)

t=# insert into so51.so53 select 19;
INSERT 0 1
t=# select so52.so54();
 so54
------
   19
(1 row)