Re: [GENERAL] How to raise error from PostgreSql SQL statement if some condition is met

2012-08-11 Thread Craig Ringer
On 08/12/2012 03:07 AM, Andrus wrote: I’m looking for a way to raise error from sql select if some condition is met. Tried code below to got error shown in comment. For anyone reading this later, Andrus also posted this on Stack Overflow: http://stackoverflow.com/questions/11916838/how-to-exe

Re: [GENERAL] How to raise error from PostgreSql SQL statement if some condition is met

2012-08-11 Thread Craig Ringer
On 08/12/2012 03:07 AM, Andrus wrote: I’m looking for a way to raise error from sql select if some condition is met. Tried code below to got error shown in comment. How to fix ? Create a small pl/pgsql function that RAISEs a message, and call that from your EXECUTEd SQL via a CASE ... WHEN .

Re: [GENERAL] How to raise error from PostgreSql SQL statement if some condition is met

2012-08-11 Thread Pavel Stehule
Hello You can execute only SQL statements - RAISE is plpgsql statement, not SQL statement, so you cannot execute it. why you don't use just CREATE OR REPLACE FUNCTION raise_exception(text) RETURNS void AS $$ BEGIN RAISE EXCEPTION '%', $1; END; $$ LANGUAGE plpgsql; SELECT raise_exception('bubu

[GENERAL] How to raise error from PostgreSql SQL statement if some condition is met

2012-08-11 Thread Andrus
I’m looking for a way to raise error from sql select if some condition is met. Tried code below to got error shown in comment. How to fix ? Andrus CREATE OR REPLACE FUNCTION "exec"(text) RETURNS text AS $BODY$ BEGIN EXECUTE $1; RETURN $1; END;

Re: [GENERAL] select distinct in a subquery bug/problem

2012-08-11 Thread Dan Halbert
On 8/11/2012 2:21 PM, Raymond O'Donnell wrote: On 11/08/2012 04:32, Dan Halbert wrote: 1. select count(t1_id) from t1 where t1_id not in (select distinct t1_id from t2 limit 1103) ==> 13357 [CORRECT result] 2. select count(t1_id) from t1 where t1_id not in (select distinct t1_id from t2 limi

Re: [GENERAL] select distinct in a subquery bug/problem

2012-08-11 Thread Raymond O'Donnell
On 11/08/2012 04:32, Dan Halbert wrote: > In version 9.1.4-0ubuntu12.04: > > > > Hi - I am getting wrong answers from a certain kind of query, and have > narrowed it down to a change in the query plan between two similar > queries. The two queries below use different query plans, and generate >

Re: [GENERAL] slowness what only full vacuum can solve

2012-08-11 Thread Laszlo Fogas
Thank you for your answers, we will try to make it more agressive! On Aug 10, 2012 11:56 PM, "Bill Moran" wrote: > On Fri, 10 Aug 2012 16:14:54 +0200 Laszlo Fogas > wrote: > > > Sorry, I wasn't clear. > > > > Autovacuum runs with default setting, I believe it's daily, or whenever > it > > feels

Re: [GENERAL] is 9.x so much better than 8.x?

2012-08-11 Thread Vick Khera
On Fri, Aug 10, 2012 at 11:32 AM, Geert Mak wrote: > do you think this is because 9.x performs better or is it possible that > our 8.x installation has been muddled up somehow? (we did totally clean > install/upgrade with drop/import) > Part of it will be from having a much more compacted table

Re: [GENERAL] External Storage of data dir

2012-08-11 Thread Craig Ringer
On 08/10/2012 09:59 PM, Benjamin Adams wrote: > Server <> iSCSI (6 Bay, Raid 5 or 10) Use RAID 10 if you care even a little bit about performance. Especially with the latency added by iSCSI. I have read GB can get 130 Mps. Megabytes per second? Not likely. AFAIK 125 is the theoreti

[GENERAL] json support for composites in upcoming 9.2

2012-08-11 Thread jan zimmek
hi, i am looking into json support of the upcoming 9.2 release and have a question about the row_to_json function. is there a way to specify the column aliases of a nested composite row without creating a custom type ? here is an example: select row_to_json(t1) from ( select 'joe' as