Re: Re: new type proposal

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Re: new type proposal
Дата
Msg-id 005b01c090e9$e44ff940$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на RE: new type proposal  (Sam Snow <2snows@MailAndNews.com>)
Список pgsql-general
Replying to my own post as I think things through.

----- Original Message -----
From: "Richard Huxton" <dev@archonet.com>


> Maybe what we need is some sort of module system for these things so you
> could do something like:
>
> USE MODULE auto_timestamp ON foo (last_modified)
>
> which could apply the rules/triggers to the relevant table/column. Two
> big pluses I can think of:
>
> 1. It lets lots of non-developers contribute (e.g. me) without hacking C.
> 2. You are using standard language features so you can learn from
> modules or cut and paste if you loathe them.
>
> I don't know how complex module support would be, but CPAN doesn't seem
> to have done perl any harm.
>
> - Richard Huxton

Actually - we've pretty much got this in 7.1 anyway.
Plpgsql gives us EXECUTE <text> so we can generate triggers etc on the fly.
\i lets us parse a file

So - you could:

-- import functions from module
\i auto_timestamp.pgmod
-- add the triggers
auto_timestamp_addto(mytable,mycolumn)
-- remove the functions provided by the module
auto_timestamp_remove_module()

Does this make sense, or am I talking rubbish here?

- Richard Huxton


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

Предыдущее
От: fabrizio.ermini@sysdat.it
Дата:
Сообщение: Re: Re: PostreSQL SQL for MySQL SQL
Следующее
От: Alexey Borzov
Дата:
Сообщение: Re: selecting a random record