Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
postgresql函数可以接受的最大参数数_Postgresql_Postgresql 9.2 - Fatal编程技术网

postgresql函数可以接受的最大参数数

postgresql函数可以接受的最大参数数,postgresql,postgresql-9.2,Postgresql,Postgresql 9.2,我有一个由两个表组成的视图。让我们说TableA和TableB 现在表A有大约20列,表B有4列 TableA ( id datatype, uid datatype, . . . 18 more); TableB ( id datatype, uid datatype, a_id datatype, amount datatype, CONSTRAINT tablea_tableb_fkey FOREIGN KEY (a_id)

我有一个由两个表组成的视图。让我们说TableA和TableB

现在表A有大约20列,表B有4列

TableA (
  id datatype,
  uid datatype,
  .  
  .   
  .
  18 more);

TableB (
  id datatype,
  uid datatype,
  a_id datatype,
  amount datatype,
  CONSTRAINT tablea_tableb_fkey FOREIGN KEY (a_id)
      REFERENCES tablea (id) MATCH SIMPLE
      ON UPDATE RESTRICT ON DELETE RESTRICT,
);
因此,表A和表B之间存在一对多关系。现在我写了如下观点

CREATE OR REPLACE VIEW AB AS 
 SELECT a.id, a.uid, ..., array_agg(b.amount) AS amounts
   FROM TableA a
   JOIN TableB b ON a.id = b.a_id
  GROUP BY i.id;
现在我想为这个视图编写insert规则,我正在编写一个helper函数。该函数使用大约18个参数(除了
id
uid
有默认值)插入到TableA中,并使用1个参数作为TableB的数组


所以函数的总参数是19。我想知道在
postgresql
中可以传递给函数的最大参数数是多少?发送这么多的参数明智吗?有没有更好的方法为这么多的参数编写函数?

FUNC\u MAX\u ARGS是一个编译参数(您可以更改它并重新编译),在我的9.2源代码中是100


如果您有更多参数,那么使用数组是一个好主意。

FUNC\u MAX\u ARGS是一个编译参数(您可以更改它并重新编译),在我的9.2源代码中是100


如果您有更多的参数,那么使用数组是一个好主意。

为了检查max function args,我在postgresql 9.2中使用了以下查询。从pg_设置中选择*,其中name='max_function_args';为了检查max函数args,我在postgresql 9.2中使用了以下查询。从pg_设置中选择*,其中name='max_function_args';