From: Hengky Liwandouw <hengkyliwandouw@gmail.com>
To: 'Sim Zacks' <sim@compulab.co.il>
To: pgsql-general@postgresql.org
Subject: Re: Crosstab function
Date: Fri, 9 May 2014 10:44:28 +0800
Message-ID: <004201cf6b30$9c48c250$d4da46f0$@com> (raw)
In-Reply-To: <536A19E2.70607@compulab.co.il>
References: <000601cf682e$2dce68c0$896b3a40$@com>
<1399299903660-5802456.post@n5.nabble.com>
<004201cf68d4$152dc3f0$3f894bd0$@com>
<1399345258676-5802601.post@n5.nabble.com>
<004601cf68dc$848e8420$8dab8c60$@com>
<536A19E2.70607@compulab.co.il>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Thanks Sim, a very usefull information.
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Sim Zacks
Sent: Wednesday, May 07, 2014 7:33 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Crosstab function
What I have done in the past to build a generic reporting application is to
have the function write the results you want in a table and return the
tablename and then have the client code call select * from that table.
My standard report tablename is tblreport || userid;
It gets dropped at the beginning of the function, so it is basically a temp
table that doesn't interfere with any other users.
Example:
execute 'drop table if exists reports.tblreport' || v_userid ;
execute 'drop sequence if exists reports.tblreport' || v_userid ||
'_id_seq; create sequence reports.tblreport' || v_userid || '_id_seq';
v_sql=' create table reports.tblreport' || v_userid || ' as ';
Sim
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: hengkyliwandouw@gmail.com, sim@compulab.co.il
Subject: Re: Crosstab function
In-Reply-To: <004201cf6b30$9c48c250$d4da46f0$@com>
References: <000601cf682e$2dce68c0$896b3a40$@com> <1399299903660-5802456.post@n5.nabble.com> <004201cf68d4$152dc3f0$3f894bd0$@com> <1399345258676-5802601.post@n5.nabble.com> <004601cf68dc$848e8420$8dab8c60$@com> <536A19E2.70607@compulab.co.il> <004201cf6b30$9c48c250$d4da46f0$@com>
* 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