Auto-timestamp generator (attached)

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Auto-timestamp generator (attached)
Дата
Msg-id 001401c091b6$f5a9df80$1001a8c0@archonet.com
обсуждение исходный текст
Ответы Re: Auto-timestamp generator (attached)
Список pgsql-general
Following the 'new type proposal' discussion recently I decided to have a
play at creating an automatic trigger generator. Attached is the sql and an
example of its use.

Basically you call a function:
  select lastchg_addto(mytable,mycol);
where mycol is of type timestamp. The function builds the

To use it you will need plpgsql enabled (man createlang) and also version
7.1
After use, there are two functions left - you can remove these with:
  drop function lastchg_addto(text,text);
  drop function lastchg_remove(text,text);

I've tried to layout the plpgsql for ease of understanding - if you want to
see how the trigger gets created, you can return exec1 or exec2 instead of
the success message.

This just a demo - obviously it's fairly simple to put together triggers for
this purpose, but I'd appreciate any thoughts about the approach.

TIA people

Oh - 2 questions for any of the developers/clued up

1. Is there any way to parse a variable-length list of parameters in
plpgsql?
2. Is there any chance of a different quoting method for functions? e.g.
    create function ... as q[ ...body here ...];
   So we can avoid the '''' stuff - it's a lot of static

- Richard Huxton

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Frank Nijenhuis
Дата:
Сообщение: need some help..securing multiple databases/users
Следующее
От: Einar Karttunen
Дата:
Сообщение: Re: Auto-timestamp generator (attached)