Project

General

Profile

Feature #4984

Composite Type Argument as table

Added by bford - almost 19 years ago. Updated over 13 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

creating composite type argument named table:

 CREATE TABLE employee (name text, basesalary integer, bonus integer); 
 CREATE TABLE employee_ext (name text, basesalary integer, bonus integer, other text); 

CREATE FUNCTION empcomp(table) RETURNS integer AS $$
  return $argsr0['basesalary'] + $argsr0['bonus'];
$$ LANGUAGE 'plphp';

SELECT name, empcomp(table) FROM employee;
SELECT name, empcomp(table) FROM employee_ext;

eg. type table is table taken from FROM (so once time will be employee, second time employee_ext)
now i must have x functions to do same thing with different argument

Also available in: Atom PDF