pl/pgsql RECORD data type, how to access to the values
От
Guillaume Bog
Тема
pl/pgsql RECORD data type, how to access to the values
Дата
Msg-id
bc5951d00804050039y6442438fwefb114c96f2d7292@mail.gmail.com
Список
Дерево обсуждения
pl/pgsql RECORD data type, how to access to the values "Guillaume Bog" <guibog@gmail.com>
Re: pl/pgsql RECORD data type, how to access to the values "Pavel Stehule" <pavel.stehule@gmail.com>
Re: pl/pgsql RECORD data type, how to access to the values "Guillaume Bog" <guibog@gmail.com>
Re: pl/pgsql RECORD data type, how to access to the values "Pavel Stehule" <pavel.stehule@gmail.com>
Re: pl/pgsql RECORD data type, how to access to the values Craig Ringer <craig@postnewspapers.com.au>
Re: pl/pgsql RECORD data type, how to access to the values "Guillaume Bog" <guibog@gmail.com>
Hello,
I'm writing a trigger in pl/pgSQL and I'd like to pass one column name as argument to the trigger function.
Provided my table has only one column named 'id', I can do easilly
CREATE FUNCTION ft() RETURNS trigger AS $$
BEGIN
RAISE NOTICE 'It works:%', OLD.id;
END
$$ LANGUAGE plpgsql;
But I'd like to do
CREATE FUNCTION ft() RETURNS trigger AS $$
DECLARE
col VARCHAR;
BEGIN
col = TG_ARGV[0]
RAISE NOTICE 'This does not works:%', OLD.col
RAISE NOTICE 'This also does not works:%', OLD[col]
END
$$ LANGUAGE plpgsql;
I tried OLD.(col) and other tricks, like "SELECT INTO" or "EXECUTE", and I checked the docs.
I'm writing a trigger in pl/pgSQL and I'd like to pass one column name as argument to the trigger function.
Provided my table has only one column named 'id', I can do easilly
CREATE FUNCTION ft() RETURNS trigger AS $$
BEGIN
RAISE NOTICE 'It works:%', OLD.id;
END
$$ LANGUAGE plpgsql;
But I'd like to do
CREATE FUNCTION ft() RETURNS trigger AS $$
DECLARE
col VARCHAR;
BEGIN
col = TG_ARGV[0]
RAISE NOTICE 'This does not works:%', OLD.col
RAISE NOTICE 'This also does not works:%', OLD[col]
END
$$ LANGUAGE plpgsql;
I tried OLD.(col) and other tricks, like "SELECT INTO" or "EXECUTE", and I checked the docs.
В списке pgsql-general по дате отправления