Re: [GENERAL] Stop execution without ERROR

2013-10-15 Thread Karsten Hilbert
On Wed, Oct 16, 2013 at 12:04:53PM +1100, James Sewell wrote: > Let's say I'm running the following SQL script via psql -f > > BEGIN > \set ON_ERROR_STOP > SELECT myFunction(); > CREATE TABLE x(id int); > END; > > Is there anything I can do in myFunction which will: > > a) Stop execution of the

Re: [GENERAL] Stop execution without ERROR

2013-10-15 Thread David Johnston
james.sewell wrote > Hello all, > > Let's say I'm running the following SQL script via psql -f > > BEGIN > \set ON_ERROR_STOP > SELECT myFunction(); > CREATE TABLE x(id int); > END; > > Is there anything I can do in myFunction which will: > > a) Stop execution of the script so that x will not b

[GENERAL] Stop execution without ERROR

2013-10-15 Thread James Sewell
Hello all, Let's say I'm running the following SQL script via psql -f BEGIN \set ON_ERROR_STOP SELECT myFunction(); CREATE TABLE x(id int); END; Is there anything I can do in myFunction which will: a) Stop execution of the script so that x will not be created b) Not throw an error (return value

Re: [GENERAL] werid error"index row size 3040 exceeds btree maximum, 2712" occur randomly

2013-10-15 Thread Tomas Vondra
On 15.10.2013 03:44, Huang, Suya wrote: > Thanks Tomas! > > However, in the example I sent, I already did a vacuum full right > after deleted the rows causing problem, before created the index and > got an error even the table is vacuumed. Note, the table is I > temporarily created using create t

Re: [GENERAL] recursive query returning extra rows in 8.4

2013-10-15 Thread Chris
On 16/10/13 01:56, Tom Lane wrote: David Johnston writes: chris smith-9 wrote Using postgres 8.4.13 (latest that redhat provides in rhel6) the query below returns an extra row compared to running the same thing in later versions (tried 9.0, 9.1, 9.2 - they don't return the extra row). Likel

Re: [GENERAL] Invalid Page Header Error

2013-10-15 Thread Carlo Curatolo
I have quite the same problem. When I lauch a vacuumdb, I have an error : ERREUR: en-tĂȘte de page invalide dans le bloc 39639 de la relation base/16384/599662 With a SELECT * FROM pg_catalog.pg_largeobject Result is ERREUR: en-tĂȘte de page invalide dans le bloc 39639 de la relation base/163

Re: [GENERAL] can you do rollback in a trigger function?

2013-10-15 Thread Shaun Thomas
On 10/15/2013 01:38 PM, Quang Thoi wrote: I want to roll back deletion if there is a reference (FK) in another table. Can I explicitly call a rollback inside a function? No. Transactions are controlled outside the body of any executing function. You do have have a couple other options, thoug

Re: [GENERAL] can you do rollback in a trigger function?

2013-10-15 Thread Vick Khera
On Tue, Oct 15, 2013 at 2:38 PM, Quang Thoi wrote: > I want to roll back deletion if there is a reference (FK) in another table. > > > Can I explicitly call a rollback inside a function? > You should RAISE an error. The transaction should roll back due to the error.

[GENERAL] can you do rollback in a trigger function?

2013-10-15 Thread Quang Thoi
I want to roll back deletion if there is a reference (FK) in another table. Can I explicitly call a rollback inside a function? CREATE OR REPLACE FUNCTION pre_del_prod_proc() returns trigger as $$ begin if exists (select 1 from host_config where config_id = OLD.id) then rollba

Re: Fwd: [GENERAL] String reverse funtion?

2013-10-15 Thread David Johnston
ginkgo36 wrote > But I can not write a function :(. please hepl me. > For example, I have column "data_text" with data like this: > Row 1: AUTO; BODY; PREDILUTED; ECD FORM; RABBIT; FORMAT; CHROMOGENIC > Row 2: ECD FORM; BODY; PREDILUTED; CHROMO-GENIC; AUTO; RABBIT; FORMAT > Row 3: FORMAT; ECD F

Re: Fwd: [GENERAL] String reverse funtion?

2013-10-15 Thread ginkgo36
Hi everyone, Please hepl me this function: 1. I want to sort string follow anphabet and I used this query: select string_agg(x, ';') from (select trim(unnest(regexp_split_to_array('ECD FORM; BODY; PREDILUTED; CHROMO-GENIC; AUTO;RABBIT; FORMAT',';'))) x order by x) a; -- result: AUTO; BODY; CH

Re: [GENERAL] recursive query returning extra rows in 8.4

2013-10-15 Thread Tom Lane
David Johnston writes: > chris smith-9 wrote >> Using postgres 8.4.13 (latest that redhat provides in rhel6) the query >> below returns an extra row compared to running the same thing in later >> versions (tried 9.0, 9.1, 9.2 - they don't return the extra row). > Likely this is a bug that was f

Re: [GENERAL] Postgresql 9.0.13 core dump

2013-10-15 Thread Laurentius Purba
Hi Tomas, Thanks for your response. Regarding using BYTEA instead of TEXT for binary content, I did a google search prior sending my first email. Also, in my first email, I mentioned that I am not convinced this query, updating a field with pdf content in a table, causing this core dump. The rea

Re: [GENERAL] Postgresql 9.0.13 core dump

2013-10-15 Thread Alban Hertroys
On 15 October 2013 14:48, Laurentius Purba wrote: > Kevin, > > Thanks for the response. I will look into it based on your suggestion. I seem to recall there was an optimization issue in llvm that could cause such behaviour with virtual machines. What I don't recall is whether the solution was to

Re: [GENERAL] recursive query returning extra rows in 8.4

2013-10-15 Thread David Johnston
chris smith-9 wrote > Hi all, > > Using postgres 8.4.13 (latest that redhat provides in rhel6) the query > below returns an extra row compared to running the same thing in later > versions (tried 9.0, 9.1, 9.2 - they don't return the extra row). > > > SELECT * > FROM numbers > ORDER BY iterati

Re: [GENERAL] Postgresql 9.0.13 core dump

2013-10-15 Thread Laurentius Purba
Kevin, Thanks for the response. I will look into it based on your suggestion. -Laurent On Mon, Oct 14, 2013 at 8:29 PM, Kevin Grittner wrote: > Laurentius Purba wrote: > > > I did google this error message, "...signal 10: Bus error.." and > > found the issue with hardware problem, memory. >

[GENERAL] Alter the default access privileges of the public schema by the db owner

2013-10-15 Thread Christian Affolter
Hi everyone I'm looking for a way to let a role which created a new database (the database owner) change (remove) the default access privileges of the public schema, which allows everyone to use and create objects within this schema. I do not want to give the role the SUPERUSER option.