📄 polymorphism.out
字号:
CREATE AGGREGATE myaggn10a(BASETYPE = int, SFUNC = tfp, STYPE = int[], FINALFUNC = ffnp, INITCOND = '{}');-- N P P N-- should ERROR: tf1p(int[],anyelement) not matched by tf1p(anyarray,int)CREATE AGGREGATE myaggn11a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[], FINALFUNC = ffnp, INITCOND = '{}');ERROR: function tf1p(integer[], anyelement) does not exist-- N P P P-- should ERROR: tfp(int[],anyelement) not matched by tfp(anyarray,anyelement)CREATE AGGREGATE myaggn12a(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[], FINALFUNC = ffnp, INITCOND = '{}');ERROR: function tfp(integer[], anyelement) does not exist-- P N N N-- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int)CREATE AGGREGATE myaggn13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: cannot determine transition data typeDETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.CREATE AGGREGATE myaggn13b(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray, INITCOND = '{}');ERROR: cannot determine transition data typeDETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.-- P N N P-- should ERROR: tf2p(anyarray, int) not matched by tf2p(int[],anyelement)CREATE AGGREGATE myaggn14a(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: cannot determine transition data typeDETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.CREATE AGGREGATE myaggn14b(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray, INITCOND = '{}');ERROR: cannot determine transition data typeDETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.-- P N P N-- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int)CREATE AGGREGATE myaggn15a(BASETYPE = anyelement, SFUNC = tfnp, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: function tfnp(anyarray, anyelement) does not existCREATE AGGREGATE myaggn15b(BASETYPE = anyelement, SFUNC = tfnp, STYPE = anyarray, INITCOND = '{}');ERROR: function tfnp(anyarray, anyelement) does not exist-- P N P P-- should ERROR: tf2p(anyarray, anyelement) not matched by tf2p(int[],anyelement)CREATE AGGREGATE myaggn16a(BASETYPE = anyelement, SFUNC = tf2p, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: function tf2p(anyarray, anyelement) does not existCREATE AGGREGATE myaggn16b(BASETYPE = anyelement, SFUNC = tf2p, STYPE = anyarray, INITCOND = '{}');ERROR: function tf2p(anyarray, anyelement) does not exist-- P P N N-- should ERROR: ffnp(anyarray) not matched by ffnp(int[])CREATE AGGREGATE myaggn17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: cannot determine transition data typeDETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.-- P P N P-- should ERROR: tfp(anyarray, int) not matched by tfp(anyarray, anyelement)CREATE AGGREGATE myaggn18a(BASETYPE = int, SFUNC = tfp, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: cannot determine transition data typeDETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.-- P P P N-- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int)CREATE AGGREGATE myaggn19a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: function tf1p(anyarray, anyelement) does not exist-- P P P P-- should ERROR: ffnp(anyarray) not matched by ffnp(int[])CREATE AGGREGATE myaggn20a(BASETYPE = anyelement, SFUNC = tfp, STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');ERROR: function ffnp(anyarray) does not exist-- create test data for polymorphic aggregatescreate temp table t(f1 int, f2 int[], f3 text);insert into t values(1,array[1],'a');insert into t values(1,array[11],'b');insert into t values(1,array[111],'c');insert into t values(2,array[2],'a');insert into t values(2,array[22],'b');insert into t values(2,array[222],'c');insert into t values(3,array[3],'a');insert into t values(3,array[3],'b');-- test the successfully created polymorphic aggregatesselect f3, myaggp01a(*) from t group by f3; f3 | myaggp01a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggp03a(*) from t group by f3; f3 | myaggp03a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggp03b(*) from t group by f3; f3 | myaggp03b ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggp05a(f1) from t group by f3; f3 | myaggp05a ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)select f3, myaggp06a(f1) from t group by f3; f3 | myaggp06a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggp08a(f1) from t group by f3; f3 | myaggp08a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggp09a(f1) from t group by f3; f3 | myaggp09a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggp09b(f1) from t group by f3; f3 | myaggp09b ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggp10a(f1) from t group by f3; f3 | myaggp10a ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)select f3, myaggp10b(f1) from t group by f3; f3 | myaggp10b ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)select f3, myaggp20a(f1) from t group by f3; f3 | myaggp20a ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)select f3, myaggp20b(f1) from t group by f3; f3 | myaggp20b ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)select f3, myaggn01a(*) from t group by f3; f3 | myaggn01a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn01b(*) from t group by f3; f3 | myaggn01b ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn03a(*) from t group by f3; f3 | myaggn03a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn05a(f1) from t group by f3; f3 | myaggn05a ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)select f3, myaggn05b(f1) from t group by f3; f3 | myaggn05b ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)select f3, myaggn06a(f1) from t group by f3; f3 | myaggn06a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn06b(f1) from t group by f3; f3 | myaggn06b ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn08a(f1) from t group by f3; f3 | myaggn08a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn08b(f1) from t group by f3; f3 | myaggn08b ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn09a(f1) from t group by f3; f3 | myaggn09a ----+----------- b | {} c | {} a | {}(3 rows)select f3, myaggn10a(f1) from t group by f3; f3 | myaggn10a ----+----------- b | {1,2,3} c | {1,2} a | {1,2,3}(3 rows)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -