From: Leif Biberg Kristensen <leif@solumslekt.org>
To: pgsql-general@postgresql.org
Subject: Re: Using Postgresql as application server
Date: Mon, 15 Aug 2011 18:24:30 +0200
Message-ID: <201108151824.31013.leif@solumslekt.org> (raw)
In-Reply-To: <CAHyXU0xQp+-sA6-oPJVTYaFBYO_R4P=fnX+jm8Pgy_j0rPcO7Q@mail.gmail.com>
References: <CAN2Y=uPjF14F5A9JXj02_vaPw4TMR0WGQid_w80xt4sC8o4qGg@mail.gmail.com>
<4E46D0D7.3090700@officenet.no>
<CAHyXU0xQp+-sA6-oPJVTYaFBYO_R4P=fnX+jm8Pgy_j0rPcO7Q@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: leif@solumslekt.org, pgsql-general@postgresql.org
Subject: Re: Using Postgresql as application server
In-Reply-To: <201108151824.31013.leif@solumslekt.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox