* Niklas Johansson <[EMAIL PROTECTED]> [2006-04-03 11:04:25 +0200]:
>
> On 2 apr 2006, at 23.08, Niklas Johansson wrote:
>
> >CREATE OR REPLACE FUNCTION exec_device_type() RETURNS trigger AS $$
> > EXECUTE "SELECT device_type" || OLD.type || "(OLD.id)";
> >$$ LANGUAGE plpgsql;
>
>
> Sorry,
On 2 apr 2006, at 23.08, Niklas Johansson wrote:
CREATE OR REPLACE FUNCTION exec_device_type() RETURNS trigger AS $$
EXECUTE "SELECT device_type" || OLD.type || "(OLD.id)";
$$ LANGUAGE plpgsql;
Sorry, I was bitten by the bedbug there: a plpgsql function needs a
little more than tha
On 2 apr 2006, at 10.31, Ключников А.С. wrote:
What is faster?
One trigger with 1000 ELSE IF
Or 1000 rules
Faster to write and easier to maintain would be to write a trigger
function in pl/pgsql which executes the right function dynamically:
CREATE OR REPLACE FUNCTION exec_device_type() RE
Hi all.
There are two tables:
create table device_types (
id int,
name varchar
);
about 1000 rows
create table devices (
id int,
type int REFERENCES device_types(id),
name varchar,
data float
);
about 20 rows
And about 1000 functions:
create function device_type1(int) returns ..
create func