Re: [GENERAL] Crosstab function

2014-05-05 Thread Hengky Liwandouw
Very Clear instruction ! Thank you very much David. I will do it in my client app and follow your guidance. -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of David G Johnston Sent: Tuesday, May 06, 2014 11:01 AM To: pgsql

Re: [GENERAL] Crosstab function

2014-05-05 Thread David G Johnston
Hengky Lie wrote > Hi David, > > Are you sure that there is no pure sql solution for this ? > > I think (with my very limited postgres knowledge), function can solve > this. > > Which is the column header I need but I really have no idea how to use > this > as column header. > > Anyway, If i c

Re: [GENERAL] Crosstab function

2014-05-05 Thread Dann Corbit
Why not use the crosstab stuff in contrib? http://www.postgresql.org/docs/9.3/static/tablefunc.html Has it been removed or something? -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Paul Jungwirth Sent: Monday, May 5, 2

Re: [GENERAL] Crosstab function

2014-05-05 Thread Paul Jungwirth
> Are you sure that there is no pure sql solution for this ? There is no pure SQL solution because a SQL query always gives a fixed number of columns. You could compose the SQL in your client app and vary the columns by the current warehouses. Or you could say GROUP BY produkit, tblwarehouse.id an

Re: [GENERAL] Crosstab function

2014-05-05 Thread Hengky Liwandouw
Hi David, Are you sure that there is no pure sql solution for this ? I think (with my very limited postgres knowledge), function can solve this. So far i can use command: select * from crosstab ( 'select produkid, warehouseid, onhand from tblproduct order by 1', 'select distinct warehou

Re: [GENERAL] Monitoring Pg servers with Microsoft SCOM

2014-05-05 Thread John R Pierce
On 5/5/2014 12:43 PM, Glen Eustace wrote: Thanks, that is the conclusion I had come to as well. I have written a management pack for collection other Linux data so may have a go at a PostgreSQL one if I get some time. I would just use check_postgres (perl) from your agent script... -- jo

Re: [GENERAL] Monitoring Pg servers with Microsoft SCOM

2014-05-05 Thread Glen Eustace
On 6/05/2014, at 1:30 am, Magnus Hagander wrote: > As long as you can run arbitrary SQL, you can get all the information out. > Assuming it can do something with it rather than just run a plain query. If > so, I suggest you take a look at the check_postgres nagios plugin or the > munin plugin

Re: [GENERAL] SELECT with column specified by subquery

2014-05-05 Thread David G Johnston
webcoyote wrote > I desire to create a SELECT statement where one of the column names comes > from another table. Something like: > > SELECT id, (SELECT type FROM favorite_food_type WHERE user = 'ralph') > FROM foods; > > If Ralph's favorite food type is fruit, ultimately I'd like the query

[GENERAL] SELECT with column specified by subquery

2014-05-05 Thread webcoyote
I desire to create a SELECT statement where one of the column names comes from another table. Something like: SELECT id, (SELECT type FROM favorite_food_type WHERE user = 'ralph') FROM foods; If Ralph's favorite food type is fruit, ultimately I'd like the query to become: SELECT id, fruit

Re: [GENERAL] Server continuously enters to recovery mode.

2014-05-05 Thread DrakoRod
Hi everybody Thank you for your help! I upgrade the version of 9.0.15 to 9.0.17. But after that constantly show this error, in all sessions: *WARNING: terminating connection because of crash of another server process DETAIL: The postmaster has commanded this server process to roll ba

Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-05 Thread Alexandros Efentakis
To answer my own question, I adapted http://stackoverflow.com/questions/16128142/how-to-use-pqxxstateless-cursor-class-from-libpqxx try { work W(*Conn); pqxx::stateless_cursor cursor(W, sql[sqlLoad], "mycursor", false); /* Assume you know

Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-05 Thread Alexandros Efentakis
Thanks John for your answer. The problem is how do I declare the cursor and fetch through C++ and libpq++? And if I fetch 1000 rows at a time, then how do I handle that when I reach the end and there are less than 1000 rows available? Or I need to fetch one row at a time like this http://stackoverf

Re: [GENERAL] envelope/postage announcement

2014-05-05 Thread Tim Clarke
On 05/05/14 17:21, Alvaro Herrera wrote: > Tim Clarke wrote: >> Michael Tocci kindly announced these packages recently and they sound >> promising but my search-fu is failing me - anyone got a link please? > http://www.3comets.com/ > > I posted a reply to his announce but now I see it didn't make i

Re: [GENERAL] envelope/postage announcement

2014-05-05 Thread Alvaro Herrera
Tim Clarke wrote: > Michael Tocci kindly announced these packages recently and they sound > promising but my search-fu is failing me - anyone got a link please? http://www.3comets.com/ I posted a reply to his announce but now I see it didn't make it through the list because I used the owner addre

[GENERAL] envelope/postage announcement

2014-05-05 Thread Tim Clarke
Michael Tocci kindly announced these packages recently and they sound promising but my search-fu is failing me - anyone got a link please? -- Tim Clarke -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpr

Re: [GENERAL] Crosstab function

2014-05-05 Thread David G Johnston
Hengky Lie wrote > The crosstab warehouse column name (OFFICE & Store2) is taken from > tblwarehouse so when user add warehouse, crosstab column name will change > automatically. And also each row has total qty. In what programming language? The only way to do this is to dynamically construct the

Re: [GENERAL] Monitoring Pg servers with Microsoft SCOM

2014-05-05 Thread Magnus Hagander
On Mon, May 5, 2014 at 3:15 AM, Glen Eustace wrote: > > On 5/05/2014, at 12:26 pm, Adrian Klaver > wrote: > > > On 05/04/2014 04:17 PM, Glen Eustace wrote: > >> I am in the process of deploying Microsoft System Centre Operations > >> Manager and was hoping that somebody had either developed or kn