Re: Using Postgresql as application server
От | Leif Biberg Kristensen |
---|---|
Тема | Re: Using Postgresql as application server |
Дата | |
Msg-id | 201108151824.31013.leif@solumslekt.org обсуждение исходный текст |
Ответ на | Re: Using Postgresql as application server (Merlin Moncure <mmoncure@gmail.com>) |
Список | pgsql-general |
On Monday 15. August 2011 16.36.23 Merlin Moncure wrote: > Postgres is not just a database -- it's a language hosting platform if > you want to use it as such. Now, you can continue to do things as > you've always done (database 'here', code 'here', web server 'here'), > but why discourage people from trying out different things? Somebody's probably going to do it -- for no other reason why than because you can. Sometimes I'll write functions like CREATE OR REPLACE FUNCTION dpp(INTEGER) RETURNS SETOF TEXT AS $$ SELECT '<p class="packed">' || ss_link_expand(source_text) || '</p>' FROM sources WHERE parent_id=$1 ORDER BY sort_order $$ LANGUAGE SQL STABLE; for dumping thext that I'll copy and paste right into a static Web page. It's a lot easier to do this in psql than a lot of other methods that I can think of. BTW, the mentioned ss_link_expand() function will generate hyperlinks on the fly from a compact format stored in the database. The concept is explained here: <http://solumslekt.org/blog/?p=151> I'm working with Postgres and PHP in tandem, and frequently write functions in sql or pl/pgsql that will output text directly in HTML format, mostly because I've found text transformation (particularly regexp_replace) in Postgres to be far superior to the equivalent methods of doing it in PHP. Leif
В списке pgsql-general по дате отправления: