Re: [GENERAL] [Q] parsing out String array

2009-08-12 Thread Scott Bailey
V S P wrote: if I have field declared myvalue text[][] insert into vladik (myval) values ( '{{"\",A", "\"B"}, {"Y", "Q"}}' ) What do you guys use in your treasurechest of 'addons' to successfully parse out the above trickery and get and get the 4 strings ",A "B Y Q from within Postgres store

Re: [GENERAL] Looping through string constants

2009-08-12 Thread Scott Bailey
Using arrays makes it a little less verbose and easier to manage IMO. SELECT v FROM unnest(array['a','b','c','d']) v Is that 8.4? or is unnest from contrib/ ? thanks! Dave Unnest is included in 8.4, but it's pretty much essential for working with arrays. Pre 8.4, you'd add the function

[GENERAL] [Q] parsing out String array

2009-08-12 Thread V S P
if I have field declared myvalue text[][] insert into vladik (myval) values ( '{{"\",A", "\"B"}, {"Y", "Q"}}' ) What do you guys use in your treasurechest of 'addons' to successfully parse out the above trickery and get and get the 4 strings ",A "B Y Q from within Postgres stored procedure as

Re: [GENERAL] trouble building pgbench on CentOS 5.3: /usr/bin/ld: cannot find -lpgport

2009-08-12 Thread Alvaro Herrera
Tom Lane escribió: > Aleksey Tsalolikhin writes: > > Hi. I am trying to build pgbench on CentOS 5.3 x86_64. > > make complains that it cannot find -lpgport > > > # cd contrib > > # make all > > You need to "make" the rest of the tree first. Or at least the > src/port/ part. Sounds like a make

Re: [GENERAL] Simulate count result are distinct between 8.3 and 8.4

2009-08-12 Thread Shoaib Mir
On Thu, Aug 13, 2009 at 9:37 AM, Chris wrote: > Emanuel Calvo Franco wrote: > >> > But in 8.4 throws this: >> >> postgres=# SELECT >> postgres-# (select count(i)+1 from prueba >> postgres(# where i < xi.i >> postgres(# ) as rownum, i, p >> postgres-# FROM prueba xi limit 5; >> rownum | i|

Re: [GENERAL] Looping through string constants

2009-08-12 Thread David Kerr
On Wed, Aug 12, 2009 at 07:10:16PM -0400, Tom Lane wrote: - David Kerr writes: - > I'd like to loop through a group of constant string values using plpgsql - > The best analog i can think of would be in a shell script - > #!/usr/bin/ksh - - > for a in a b c d e; do - - Use VALUES? looks like th

Re: [GENERAL] trouble building pgbench on CentOS 5.3: /usr/bin/ld: cannot find -lpgport

2009-08-12 Thread Aleksey Tsalolikhin
On Wed, Aug 12, 2009 at 4:19 PM, Tom Lane wrote: > Aleksey Tsalolikhin writes: >> Hi.  I am trying to build pgbench on CentOS 5.3 x86_64. >> make complains that it cannot find -lpgport > >> # cd contrib >> # make all > > You need to "make" the rest of the tree first.  Or at least the > src/port/ p

Re: [GENERAL] Simulate count result are distinct between 8.3 and 8.4

2009-08-12 Thread Chris
Emanuel Calvo Franco wrote: hi people! I have this test query to simulate rownums in 8.3: SELECT (select count(i)+1 from prueba where i < xi.i ) as rownum, i, p FROM prueba xi limit 5; Devuelve , que esta bien: 1;1;"299361" 2;2;"421127" 3;3;"166284" 4;4;"458945" 5;5;"81619" But in 8.4 throws

Re: [GENERAL] Looping through string constants

2009-08-12 Thread Tim Landscheidt
David Kerr wrote: > I'd like to loop through a group of constant string values using plpgsql > The best analog i can think of would be in a shell script > #!/usr/bin/ksh > for a in a b c d e; do > echo $a > done > ./a.ksh > a > b > c > d > e > Is there some tricky way I can make that happen i

Re: [GENERAL] trouble building pgbench on CentOS 5.3: /usr/bin/ld: cannot find -lpgport

2009-08-12 Thread Tom Lane
Aleksey Tsalolikhin writes: > Hi. I am trying to build pgbench on CentOS 5.3 x86_64. > make complains that it cannot find -lpgport > # cd contrib > # make all You need to "make" the rest of the tree first. Or at least the src/port/ part. regards, tom lane -- Sent via

Re: [GENERAL] Looping through string constants

2009-08-12 Thread Tom Lane
David Kerr writes: > I'd like to loop through a group of constant string values using plpgsql > The best analog i can think of would be in a shell script > #!/usr/bin/ksh > for a in a b c d e; do Use VALUES? regression=# create function foo() returns int as $$ regression$# declare s int := 0; r

[GENERAL] trouble building pgbench on CentOS 5.3: /usr/bin/ld: cannot find -lpgport

2009-08-12 Thread Aleksey Tsalolikhin
Hi. I am trying to build pgbench on CentOS 5.3 x86_64. make complains that it cannot find -lpgport # cd contrib # make all ... make[1]: Entering directory `/home/tsalolia/postgresql-8.3.7/contrib/pgbench' gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -

[GENERAL] Looping through string constants

2009-08-12 Thread David Kerr
I'd like to loop through a group of constant string values using plpgsql The best analog i can think of would be in a shell script #!/usr/bin/ksh for a in a b c d e; do echo $a done ./a.ksh a b c d e Is there some tricky way I can make that happen in postgres? (I don't want to put the values

[GENERAL] Simulate count result are distinct between 8.3 and 8.4

2009-08-12 Thread Emanuel Calvo Franco
hi people! I have this test query to simulate rownums in 8.3: SELECT (select count(i)+1 from prueba where i < xi.i ) as rownum, i, p FROM prueba xi limit 5; Devuelve , que esta bien: 1;1;"299361" 2;2;"421127" 3;3;"166284" 4;4;"458945" 5;5;"81619" But in 8.4 throws this: postgres=# SELECT post

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Daniel Verite
Sam Mason wrote: > > But for rows, there is no such thing. You can't assign null to a row, it > > makes no sense and actually causes an error. > > What makes you say this? There's no reason I can see that would cause > row values should be special in this way. Maybe if you could define

Re: [GENERAL] synchronous_commit and mvcc

2009-08-12 Thread Andy Colson
Kelly Burkhart wrote: Hello, We have synchronous_commit=off in our postgresql.conf file. Does this setting affect mvcc? For instance if I have two connections from processes on different machines that do the following: c1 begins transaction c1 inserts rows into table c1 commits transaction

Re: [GENERAL] synchronous_commit and mvcc

2009-08-12 Thread Greg Stark
On Wed, Aug 12, 2009 at 8:28 PM, Kelly Burkhart wrote: > Hello, > > We have synchronous_commit=off in our postgresql.conf file.  Does this > setting affect mvcc? If you don't have a crash then there is absolutely no difference from the clients' point of view (besides speed). If you have a crash y

[GENERAL] synchronous_commit and mvcc

2009-08-12 Thread Kelly Burkhart
Hello, We have synchronous_commit=off in our postgresql.conf file. Does this setting affect mvcc? For instance if I have two connections from processes on different machines that do the following: c1 begins transaction c1 inserts rows into table c1 commits transaction c2 begins transaction c2 q

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Sam Mason
On Wed, Aug 12, 2009 at 08:02:10PM +0200, Daniel Verite wrote: >Sam Mason wrote: > > But it seems to be a somewhat arbitrary choice to handle > > IS NULL for rows differently from everything else. > > For scalar or array types, "is null" means that the value happens to be that > special value that

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Daniel Verite
Sam Mason wrote: > But it seems to be a somewhat arbitrary choice to handle > IS NULL for rows differently from everything else. For scalar or array types, "is null" means that the value happens to be that special value that we call null. No conceptual problem here. But for rows, there is

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Sam Mason
On Wed, Aug 12, 2009 at 04:14:31PM +0200, Daniel Verite wrote: > But IS NULL applied to an array is useless to test if there are null values > inside, whereas this is apparently the whole point of IS NULL applied to > rows. > I mean: > select a is null from (select array[null]) x(a); > returns fa

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Merlin Moncure
On Wed, Aug 12, 2009 at 10:14 AM, Daniel Verite wrote: >        Sam Mason wrote: > >> Nope, I still don't get it.  Why treat rows specially?  If this was >> true, then what should: >> >>   SELECT a IS NULL, a IS NOT NULL >>   FROM (SELECT ARRAY [1,NULL]) x(a); >> >> evaluate to?  As "part of it" is

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Daniel Verite
Sam Mason wrote: > Nope, I still don't get it. Why treat rows specially? If this was > true, then what should: > > SELECT a IS NULL, a IS NOT NULL > FROM (SELECT ARRAY [1,NULL]) x(a); > > evaluate to? As "part of it" is NULL and part isn't then, by your > reasoning, it should retu

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Tom Lane
Magnus Hagander writes: >>> If I'm not mistaken, it's possible to put your password in the .pgpass >>> file in the postgres-users home folder, on the server where the postgres >>> cluster is running. > You need to put it in the .pgpass file of the postgres user - the one > that runs the server. .

Re: [GENERAL] Adding ACL notion to existing tables

2009-08-12 Thread Bruno Baguette
Le 08/08/09 02:13, Bruno Baguette a écrit : As you can see, I'm not really convinced for SOLUTION A or SOLUTION B as they have both some CONS. And they will both require some stored procedures to check references integrity. Solution B seems to be less weird to me. What would you do in that ki

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Sam Mason
On Wed, Aug 12, 2009 at 10:51:04AM +0200, Willy-Bas Loos wrote: > > SELECT r IS NULL, r IS NOT NULL > > FROM (VALUES (1,NULL)) r(a,b); > > > > returns FALSE for *both* columns. How can a row be both NULL *and* > > non-NULL? > > Actually, the value is neither NULL, nor non-NULL. > Part of it is

[GENERAL] totally different plan when using partitions

2009-08-12 Thread Scara Maccai
query using partitions explicitly ("1"): explain analyze select nome1, thv3tralacc, dltbfpgpdch FROM cell_bsc_60_0610 as cell_bsc left outer join teststscell73_0610_1 as data on data.ne_id=cell_bsc.nome1 left outer join teststsce

[GENERAL] plpython.dll dependencies

2009-08-12 Thread Alan Millington
I note that plpython.dll references a specific Python version. In the case of Postgres 8.1.4, which is what I have installed, the reference is to Python24.dll.   Is there yet a Postgres version in which plpython.dll references Python26.dll? (I am running on Windows XP Professional Service Pack

Re: [GENERAL] comparing NEW and OLD (any good this way?)

2009-08-12 Thread Willy-Bas Loos
> SELECT r IS NULL, r IS NOT NULL > FROM (VALUES (1,NULL)) r(a,b); > > returns FALSE for *both* columns. How can a row be both NULL *and* > non-NULL? Actually, the value is neither NULL, nor non-NULL. Part of it is NULL and part of it isn't so neither "IS NULL" is true, nor is "IS NOT NULL" ch

Re: [GENERAL] ERROR: XLogFlush: request AF/5703EDC8 is not satisfied --- flushed only to AF/50F15ABC

2009-08-12 Thread Richard Huxton
utsav.turray wrote: Dear All, I am using postgres 7.3 version on RHEL 4.0. My database has been restored. All tables all working fine i.e select , update but on a particular table its showing error ERROR: XLogFlush: request AF/5703EDC8 is not satisfied --- flushed only to AF/50F15ABC I have s

Re: [GENERAL] PQoidValue - isn't it for...?

2009-08-12 Thread Magnus Hagander
On Wed, Aug 12, 2009 at 10:11, Jim Michaels wrote: > I am struggling to learn libpq. > > for some reason, I could not get an INSERT to produce an Oid.  actually, By default, tables are created without Oids. > what I am looking for, is to get the ID of the last record inserted or to > verify that

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Tommy Gildseth
Ow Mun Heng wrote: -Original Message- From: Magnus Hagander [mailto:mag...@hagander.net] On Wed, Aug 12, 2009 at 09:30, Ow Mun Heng wrote: From: Tommy Gildseth [mailto:tommy.gilds...@usit.uio.no] Ow Mun Heng wrote: I'm starting to use DBLink / DBI-Link and one of the "bad" things is

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Ow Mun Heng
-Original Message- >From: Magnus Hagander [mailto:mag...@hagander.net] >No, we're talking about operating system user here, not postgres user. >So the owner of the database object is irrelevant - only the user that >the backend process is executing as. Got it.. Thanks for the tip. --

[GENERAL] PQoidValue - isn't it for...?

2009-08-12 Thread Jim Michaels
I am struggling to learn libpq. for some reason, I could not get an INSERT to produce an Oid. actually, what I am looking for, is to get the ID of the last record inserted or to verify that I inserted a record successfully. I think you use PQresultStatus() for that.(?) Isn't PQoidValue() for

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Magnus Hagander
On Wed, Aug 12, 2009 at 10:01, Ow Mun Heng wrote: > > > -Original Message- > From: Magnus Hagander [mailto:mag...@hagander.net] > On Wed, Aug 12, 2009 at 09:30, Ow Mun Heng wrote: >>> >>> From: Tommy Gildseth [mailto:tommy.gilds...@usit.uio.no] >>> >>> Ow Mun Heng wrote: > I'm starting

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Ow Mun Heng
-Original Message- From: Magnus Hagander [mailto:mag...@hagander.net] On Wed, Aug 12, 2009 at 09:30, Ow Mun Heng wrote: >> >> From: Tommy Gildseth [mailto:tommy.gilds...@usit.uio.no] >> >> Ow Mun Heng wrote: I'm starting to use DBLink / DBI-Link and one of the "bad" things is >>>tha

Re: [GENERAL] NOTICE: there is no transaction in progress

2009-08-12 Thread Richard Huxton
Rodrick Hales wrote: We have two machines that run a C application that interfaces with a Postgres database. They are our development and production machines. The version is PostgreSQL 8.3.7 on i686-redhat-linux-gnu, complied by GCC gcc (GCC) 4.1.2.20071124 (Red Hat 4.1.2-42) . On the developme

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Magnus Hagander
On Wed, Aug 12, 2009 at 09:30, Ow Mun Heng wrote: > > > -Original Message- > From: Tommy Gildseth [mailto:tommy.gilds...@usit.uio.no] > > Ow Mun Heng wrote: >>> I'm starting to use DBLink / DBI-Link and one of the "bad" things is that >>> the password is out in the clear. >>> What can I do

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Tommy Gildseth
Ow Mun Heng wrote: -Original Message- From: Tommy Gildseth [mailto:tommy.gilds...@usit.uio.no] Ow Mun Heng wrote: I'm starting to use DBLink / DBI-Link and one of the "bad" things is that the password is out in the clear. What can I do to prevent it from being such? How do I protect

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Ow Mun Heng
-Original Message- From: Tommy Gildseth [mailto:tommy.gilds...@usit.uio.no] Ow Mun Heng wrote: >> I'm starting to use DBLink / DBI-Link and one of the "bad" things is that >> the password is out in the clear. >> What can I do to prevent it from being such? How do I protect it from >> '

Re: [GENERAL] Best way to "mask" password in DBLINK

2009-08-12 Thread Tommy Gildseth
Ow Mun Heng wrote: I'm starting to use DBLink / DBI-Link and one of the "bad" things is that the password is out in the clear. What can I do to prevent it from being such? How do I protect it from 'innocent' users? If I'm not mistaken, it's possible to put your password in the .pgpass file