Re: [GENERAL] RE: [GENERAL] INSERT. RETURNING for copying records

2012-09-08 Thread dinesh kumar
Hi David, I am not sure the RETURNING offers you the following behavior .. What I'm looking for +--+-+ | original_rid | rid | +--+-+ | 1| 4 | | 2| 5 | | 3| 6 |

Re: [GENERAL] PostgreSQL server embedded in NAS firmware?

2012-09-08 Thread Thomas Munro
On 6 September 2012 23:40, Andrew Barnham andrew.barn...@gmail.com wrote: Scratch that. An immediate show stopping pitfall occurs to me: the necessity to match CPU/OS Architecture between primary server and replicate target. Doubtful that there are any consumer NAS products out there running

Re: [GENERAL] RE: [GENERAL] INSERT. RETURNING for copying records

2012-09-08 Thread David Johnston
Maybe: Where newvals AS () , insertval AS (insert...select...from newvals) #NO RETURNING Select * from newvals I believe the insertval CTE is guaranteed to run even if not directly involved with the main select statement. David J. On Sep 8, 2012, at 2:33, dinesh kumar dineshkuma...@gmail.com

[GENERAL] Add a check an a array column

2012-09-08 Thread vdg
Hello, I have a column defined as test bigint[] I would like to add a constraint on this column: the values stored must be between 0 and 1023 inclusive I know how to add a constraint on a column which is not an array: check (test x'400'::bigint) but i can't find the way to do that when

Re: [GENERAL] Add a check an a array column

2012-09-08 Thread Andreas Kretschmer
vdg vdg.encel...@gmail.com wrote: Hello, I have a column defined as test bigint[] I would like to add a constraint on this column: the values stored must be between 0 and 1023 inclusive I know how to add a constraint on a column which is not an array: check (test

Re: [GENERAL] Packaging of plpython

2012-09-08 Thread Peter Eisentraut
On Fri, 2012-09-07 at 22:41 +0300, Gražvydas Valeika wrote: What is the problem to provide both plpython2 and plpython3, or keep same (2 or 3) plpython available by default on both platforms? It is the decision of the respective packagers which version they provide and how much effort they want

Re: [GENERAL] Add a check an a array column

2012-09-08 Thread Joel Hoffman
More concisely, you can compare directly against all values of the array: # create table i (i int[] check (0 = ALL(i) AND 1023 = ALL(i))); # insert into i values (ARRAY[0,1,2,3,1023]); # insert into i values (ARRAY[0,1,2,3,-1]); ERROR: new row for relation i violates check constraint i_i_check #

Re: [GENERAL] Packaging of plpython

2012-09-08 Thread Gražvydas Valeika
It is the decision of the respective packagers which version they provide and how much effort they want to put in. If you have issues with their decisions, you could try to submit a bug report to their respective bug trackers. Btw., Debian and Ubuntu provide PL/Python for Python 2 and 3,

Re: [GENERAL] Packaging of plpython

2012-09-08 Thread John R Pierce
On 09/08/12 9:26 AM, Peter Eisentraut wrote: Personally, I think the Windows packagers made a mistake by providing Python 3 only at this point. does the windows package include its own self sufficient python runtime, or does it rely on a specific 3rd party python being installed ? if the

Re: [GENERAL] Packaging of plpython

2012-09-08 Thread Gražvydas Valeika
does the windows package include its own self sufficient python runtime, or does it rely on a specific 3rd party python being installed ? if the latter, is python 2.x available or just 3.x ? As I understand plpython on windows is only adapter to ActiveState Python 2 or 3. EDB installer

[GENERAL] Re: [GENERAL] INSERT… RETURNING for copying records

2012-09-08 Thread Misa Simic
You can make function what returns integer and has input parametars as other columns of the table: INSERT INTO testing (category, name, fk_parent) (input parameters) returning rid Then SELECT rid as OriginalId, make_copy(other columns) as new_rid From testing Kind Regards, Misa On Friday,

Re: [GENERAL] Add a check an a array column

2012-09-08 Thread Andreas Kretschmer
Joel Hoffman joel.hoff...@gmail.com wrote: More concisely, you can compare directly against all values of the array: # create table i (i int[] check (0 = ALL(i) AND 1023 = ALL(i))); # insert into i values (ARRAY[0,1,2,3,1023]); # insert into i values (ARRAY[0,1,2,3,-1]); ERROR: new row

Re: [GENERAL] Add a check an a array column

2012-09-08 Thread Bret Stern
On Sat, 2012-09-08 at 21:24 +0200, Andreas Kretschmer wrote: Joel Hoffman joel.hoff...@gmail.com wrote: More concisely, you can compare directly against all values of the array: # create table i (i int[] check (0 = ALL(i) AND 1023 = ALL(i))); # insert into i values

[GENERAL] copy from .. How to get rid of encoding check for bytea coumns

2012-09-08 Thread Roman Golis
I am trying to load data into a rather simple table: CREATE TABLE public.files ( id SERIAL, idchar CHAR(32) NOT NULL, content BYTEA, CONSTRAINT files_pkey PRIMARY KEY(id) ) WITHOUT OIDS; with this command: copy files (idchar, content) from '/data/1.dat' delimiter '|'; The database