[GENERAL] Get RULE condition and commands

2012-06-14 Thread Vlad Arkhipov
What is the proper way of getting RULE condition and commands? The query below does not work. select pg_get_expr(ev_qual, ev_class, true) as condition, pg_get_expr(ev_action, ev_class, true) as commands from pg_rewrite; ERROR: bogus varno: 2 ** Error ** ERROR: bogus va

Re: [GENERAL] pg_ctl start close the cmd.exe then the server would stop.

2012-06-14 Thread gelin yan
On Fri, Jun 15, 2012 at 8:24 AM, xytianer wrote: > pg_ctl start close the cmd.exe then the server would stop. > > i use the command pg_ctl start my dbserver in cmd. then i could not > close the cmd.exe , if i do, the server will stop. > > can someone give me some advice? > > -- > View th

Re: [GENERAL] about seperate users in PostgreSQL

2012-06-14 Thread Craig Ringer
On 06/14/2012 08:31 PM, Egidijus wrote: Hello, How it’s possible to make that seperate users can see and control only their own databases when they connected to PostgreSQL server? Standard PostgreSQL configuration allows users to see databases of other users. In my PostgreSQL server all users h

[GENERAL] pg_ctl start close the cmd.exe then the server would stop.

2012-06-14 Thread xytianer
pg_ctl start close the cmd.exe then the server would stop. i use the command pg_ctl start my dbserver in cmd. then i could not close the cmd.exe , if i do, the server will stop. can someone give me some advice? -- View this message in context: http://postgresql.1045698.n5.nabble.com/pg

Re: [GENERAL] Empty arrays vs. NULLs, 9.1 & 8.3

2012-06-14 Thread Steve Crawford
On 06/14/2012 03:54 PM, Ken Tanzer wrote: Thanks Steve. FWIW I looked at the 9.0 and 9.1 release notes, and didn't find much on arrays in them. The notes are terse (a 1-2 line comment encapsulates the results of hundreds of messages covering a couple year) but there are many references to upda

Re: [GENERAL] Empty arrays vs. NULLs, 9.1 & 8.3

2012-06-14 Thread Ken Tanzer
Thanks Steve. FWIW I looked at the 9.0 and 9.1 release notes, and didn't find much on arrays in them. I do have one follow-up curiosity question, though. Why does array_dims(array[]::varchar[]) return NULL instead of 0? I would expect NULL for a NULL array, but not an empty one. (And the same

Re: [GENERAL] Empty arrays vs. NULLs, 9.1 & 8.3

2012-06-14 Thread Steve Crawford
On 06/14/2012 12:47 PM, Ken Tanzer wrote: Hi. I had this piece of SQL, which ran fine on my 9.1 installation: INSERT INTO foo SELECT ..., CASE WHEN NOT allow_output_screen THEN array['O_SCREEN'] ELSE array[]::varchar[] END || CASE WHEN NOT allow_output_spreadsheet THEN array['O_TEMPLATE'] ELS

Re: [GENERAL] Is there a way to ask PostgreSQL for the name of the computer it's running on?

2012-06-14 Thread Hellmuth Vargas
Hi SELECT inet_server_addr(); On Thu, Jun 14, 2012 at 4:43 PM, Guillaume Lelarge wrote: > On Thu, 2012-06-14 at 04:33 +, Rob Richardson wrote: > > My customer has 3 computers. The PostgreSQL service could be running on > either of two of them. There is currently no way in our system to > d

Re: [GENERAL] Is there a way to ask PostgreSQL for the name of the computer it's running on?

2012-06-14 Thread Guillaume Lelarge
On Thu, 2012-06-14 at 04:33 +, Rob Richardson wrote: > My customer has 3 computers. The PostgreSQL service could be running on > either of two of them. There is currently no way in our system to determine > which one it is running on. The third computer sometimes needs to know which > of

[GENERAL] parsing SQLERRM ?

2012-06-14 Thread david.sahagian
(version == 9.1) In my PL/pgSQL stored functions, I want to be able to distinguish which FK-constraint caused the [foreign_key_violation] exception. . . . BEGIN delete from MY_COOL_TABLE where id = 123 ; EXCEPTION WHEN foreign_key_violation THEN CASE WHEN (SQLERRM tell

Re: [GENERAL] Empty arrays vs. NULLs, 9.1 & 8.3

2012-06-14 Thread John R Pierce
On 06/14/12 12:47 PM, Ken Tanzer wrote: p.s., On a side note, unless I've overlooked them before, the "this page in other versions..." links in the doc pages seem to be new, and are immensely helpful. Especially because Google searches often return results to the older versions. indeed, thats

[GENERAL] Empty arrays vs. NULLs, 9.1 & 8.3

2012-06-14 Thread Ken Tanzer
Hi. I had this piece of SQL, which ran fine on my 9.1 installation: INSERT INTO foo SELECT ..., CASE WHEN NOT allow_output_screen THEN array['O_SCREEN'] ELSE array[]::varchar[] END  || CASE WHEN NOT allow_output_spreadsheet THEN array['O_TEMPLATE'] ELSE array[]::varchar[] END, ...; However, this

Re: [GENERAL] Submit query using dblink that hung the host

2012-06-14 Thread Merlin Moncure
On Thu, Jun 14, 2012 at 11:15 AM, Alex Lai wrote: > My host was freeze up after submitted the following query that prevented me > to ssh to the host. > I was unable to psql and submit pg_cancel_backend.  The tables have over 20 > millions rows. > Does dblink uses too much resource from the host wh

[GENERAL] Submit query using dblink that hung the host

2012-06-14 Thread Alex Lai
My host was freeze up after submitted the following query that prevented me to ssh to the host. I was unable to psql and submit pg_cancel_backend. The tables have over 20 millions rows. Does dblink uses too much resource from the host when join large tables. Hope someone can give me suggestion.

Re: [GENERAL] Is there a way to ask PostgreSQL for the name of the computer it's running on?

2012-06-14 Thread Steve Crawford
On 06/13/2012 09:33 PM, Rob Richardson wrote: My customer has 3 computers. The PostgreSQL service could be running on either of two of them. There is currently no way in our system to determine which one it is running on. The third computer sometimes needs to know which of the other two co

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Tom Lane
Stefan Schwarzer writes: > On Jun 14, 2012, at 3:32 PM, Adrian Klaver wrote: >> 1) Do the above files actually exist in the above location? > Yes, the c.h exist in the mentioned location. However, as it does not > indicate where it looks for the stdio.h, perhaps the problem lies there. Indeed.

Re: [GENERAL] Error message "psql: could not connect to server: No such file or directory"

2012-06-14 Thread Adrian Klaver
On 06/14/2012 06:48 AM, Stefan Schwarzer wrote: > >>> Hi there, >>> >>> I guess this is a typical user error. I searched around to find the >>> solution, but in vain. >>> >>> I just upgraded to Lion, and used Kyngchaos libraries for installation of >>> Postgres. >>> >>> Try to get running postgr

Re: [GENERAL] RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION

2012-06-14 Thread Merlin Moncure
On Thu, Jun 14, 2012 at 1:10 AM, utsav wrote: > I am doing Oracle to PostgreSQL migration activity as part of Procedure > Migration in Oracle there are *OUT parameters which return records(using > bulk collect) of custom type.* > > *like function returing type1,type2. * > > What will be alternativ

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Alban Hertroys
On 12 June 2012 14:21, Stefan Schwarzer wrote: > But the "make" process gives me this: > > cd contrib/tablefunc > tablefunc $ make > gcc -Os -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk I think that's where it looks for the standard C headers? In that case that's what you need to change.

Re: [GENERAL] Error message "psql: could not connect to server: No such file or directory"

2012-06-14 Thread Stefan Schwarzer
>> Hi there, >> >> I guess this is a typical user error. I searched around to find the >> solution, but in vain. >> >> I just upgraded to Lion, and used Kyngchaos libraries for installation of >> Postgres. >> >> Try to get running postgres, and I get this: >> >> /usr/local/pgsql-9.1/bi

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Stefan Schwarzer
On Jun 14, 2012, at 3:32 PM, Adrian Klaver wrote: > On 06/14/2012 04:47 AM, Stefan Schwarzer wrote: >>> In file included from /usr/local/pgsql-9.1/include/server/postgres.h:47, >>> from tablefunc.c:33: >>> /usr/local/pgsql-9.1/include/server/c.h:67:19: error: stdio.h: No such fil

Re: [GENERAL] Error message "psql: could not connect to server: No such file or directory"

2012-06-14 Thread Adrian Klaver
On 06/14/2012 06:30 AM, Stefan Schwarzer wrote: Hi there, I guess this is a typical user error. I searched around to find the solution, but in vain. I just upgraded to Lion, and used Kyngchaos libraries for installation of Postgres. Try to get running postgres, and I get this: /usr/l

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Adrian Klaver
On 06/14/2012 04:47 AM, Stefan Schwarzer wrote: In file included from /usr/local/pgsql-9.1/include/server/postgres.h:47, from tablefunc.c:33: /usr/local/pgsql-9.1/include/server/c.h:67:19: error: stdio.h: No such file or directory /usr/local/pgsql-9.1/include/server/c.h:68:20:

[GENERAL] Error message "psql: could not connect to server: No such file or directory"

2012-06-14 Thread Stefan Schwarzer
Hi there, I guess this is a typical user error. I searched around to find the solution, but in vain. I just upgraded to Lion, and used Kyngchaos libraries for installation of Postgres. Try to get running postgres, and I get this: /usr/local/pgsql-9.1/bin/psql -U postgres psql: co

Re: [GENERAL] about seperate users in PostgreSQL

2012-06-14 Thread Andreas Kretschmer
Egidijus wrote: > Hello, > > How it’s possible to make that seperate users can see and control only their > own databases when they connected to PostgreSQL server? Standard PostgreSQL > configuration allows users to see databases of other users. > > In my PostgreSQL server all users have thei

Re: [GENERAL] Backslashitis

2012-06-14 Thread Raghavendra
> > With standard conforming strings on, you could use any of the following: > > update foo set a= E'{"blah here"}'; > update foo set a= '{"blah \\here"}'; > update foo set a= ARRAY[E'blah \\here']; > update foo set a= ARRAY['blah \here']; > > I tend to prefer the ARRAY[...] constructor syntax

Re: [GENERAL] pg_upgrade: "pg_ctl failed to start the new server"

2012-06-14 Thread Evan D. Hoffman
Actually I found the solution right after I sent that email (of course): https://wiki-bsse.ethz.ch/download/attachments/55283107/PostgreSQL_9_Maintenance_Backup_and_Recovery_final.docx Has to do with the order in which shared libs are loaded when both 9.0 and 9.1 are installed. Renaming the con

Re: [GENERAL] installation problems on OSX Lion

2012-06-14 Thread Pratik Chauhan
Thank for your post... -- View this message in context: http://postgresql.1045698.n5.nabble.com/installation-problems-on-OSX-Lion-tp4627419p5712557.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.or

Re: [GENERAL] pg_upgrade: "pg_ctl failed to start the new server"

2012-06-14 Thread Evan D. Hoffman
Woops. The file that had to be renamed was /etc/ld.so.conf.d/postgresql-9.0-libs.conf => postgresql-9.old-libs.conf . Prior to rename, ldconfig output was: # ldconfig -p | grep pq libpqwalreceiver.so (libc6) => /usr/pgsql-9.0/lib/libpqwalreceiver.so libpqwalreceiver.so (libc6) => /usr/pgsql-9.

[GENERAL] about seperate users in PostgreSQL

2012-06-14 Thread Egidijus
Hello, How it’s possible to make that seperate users can see and control only their own databases when they connected to PostgreSQL server? Standard PostgreSQL configuration allows users to see databases of other users. In my PostgreSQL server all users have their own logins. I’d like that us

Re: [GENERAL] Backslashitis

2012-06-14 Thread Dean Rasheed
On 14 June 2012 10:03, Raghavendra wrote: > > On Thu, Jun 14, 2012 at 2:19 PM, Thomas Kellerer wrote: >> >> haman...@t-online.de, 14.06.2012 10:17: >> >>> Hi, >>> >>> I have a column declared as array of text. I can get a single backslash >>> into one of the array elements by >>> update ... set m

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Stefan Schwarzer
> In file included from /usr/local/pgsql-9.1/include/server/postgres.h:47, > from tablefunc.c:33: > /usr/local/pgsql-9.1/include/server/c.h:67:19: error: stdio.h: No such file > or directory > /usr/local/pgsql-9.1/include/server/c.h:68:20: error: stdlib.h: No such file > or direc

Re: [GENERAL] Reference with inheritance propagate data

2012-06-14 Thread Chris Travers
On Thu, Jun 14, 2012 at 2:08 AM, Yuriy Rusinov wrote: > Hello, Jeff ! > >> >> One foreign key cannot reference two tables. >> >> Have you considered a design that does not use inheritance? For >> instance, the users table could reference q_base_table, and then >> record_rubricator could also refer

Re: [GENERAL] Reference with inheritance propagate data

2012-06-14 Thread Yuriy Rusinov
Hello, Jeff ! > > One foreign key cannot reference two tables. > > Have you considered a design that does not use inheritance? For > instance, the users table could reference q_base_table, and then > record_rubricator could also reference q_base_table? Unfortunately not, because this design does

Re: [GENERAL] Backslashitis

2012-06-14 Thread Raghavendra
On Thu, Jun 14, 2012 at 2:19 PM, Thomas Kellerer wrote: > haman...@t-online.de, 14.06.2012 10:17: > > Hi, >> >> I have a column declared as array of text. I can get a single backslash >> into one of the array elements by >> update ... set mycol[1] = E'blah \\here' >> If I try to update the whole

Re: [GENERAL] Backslashitis

2012-06-14 Thread Thomas Kellerer
haman...@t-online.de, 14.06.2012 10:17: Hi, I have a column declared as array of text. I can get a single backslash into one of the array elements by update ... set mycol[1] = E'blah \\here' If I try to update the whole array update ... set mycol = E'{"blah \\here"}' the backslash is missing. I

Re: [GENERAL] Backslashitis

2012-06-14 Thread Raghavendra
I think you need to double the quotes. Its mentioned in the PG documention http://www.postgresql.org/docs/9.1/static/arrays.html Eg:- postgres=# update array_test set name=E'{"meeting"}'; UPDATE 2 postgres=# select * from array_test ; name --- {"meet\\ing"} {"meet\\ing"} (2

[GENERAL] Backslashitis

2012-06-14 Thread hamann . w
Hi, I have a column declared as array of text. I can get a single backslash into one of the array elements by update ... set mycol[1] = E'blah \\here' If I try to update the whole array update ... set mycol = E'{"blah \\here"}' the backslash is missing. I can get two backslashes there. Is there a

Re: [GENERAL] Daisy chaining replication slaves ?

2012-06-14 Thread Albe Laurenz
Rob Cowell wrote: > I'm just wondering if there is a way to slave from a slave server? > > I have a Postgres9.1.3 master serving up data quite happily to the web applications, and I have also > set up a slave via streaming replication. > > I've now been asked by my manager to set up a secondary s

Re: [GENERAL] How to create c language in postgresql database. Thanks.

2012-06-14 Thread Albe Laurenz
leaf_yxj wrote: > Thanks for your answers. I really appreciate it. Although I don't understand the whole things you guys > mentioned to me. I think maybe I should do it by myself. I need to do a test. If there is any good > guide/white paper, please give me a link for me to study. I think the docu

Re: [GENERAL] Is there a way to ask PostgreSQL for the name of the computer it's running on?

2012-06-14 Thread Albe Laurenz
Rob Richardson wrote: > My customer has 3 computers. The PostgreSQL service could be running on either of two of them. There > is currently no way in our system to determine which one it is running on. The third computer > sometimes needs to know which of the other two computers is active. It wo