[GENERAL] PL/PG SQL: select count(*) into from where - does not compute the where cond

2009-09-23 Thread Abraham, Danny
Instead it returns the full count of the table. Any idea? Thanks Danny Abraham BMC Software CTM&D Business Unit 972-52-4286-513 danny_abra...@bmc.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/

Re: [GENERAL] PL/PG SQL: select count(*) into from where - does not compute the where cond

2009-09-23 Thread Pavel Stehule
Hello try to check if there are some column names are equal to variable names. This is symptom of identifier collision. regards Pavel Stehule 2009/9/23 Abraham, Danny : > Instead it returns the full count of the table. > > Any idea? > > Thanks > > Danny Abraham > BMC Software > CTM&D Business U

Re: [GENERAL] PL/PG SQL: select count(*) into from where - does not compute the where cond

2009-09-23 Thread A. Kretschmer
In response to Abraham, Danny : > Instead it returns the full count of the table. > > Any idea? No. Can you show us an example? test=*# select * from o; i --- 3 1 2 (3 rows) test=*# create or replace function my_count() returns int as $$declare c int;begin select into c count(1) from o whe

Re: [GENERAL] PL/PG SQL: select count(*) into from where - does not compute the where cond

2009-09-23 Thread Pavel Stehule
Hello try to check if there are some column names are equal to variable names. This is symptom of identifier collision. regards Pavel Stehule > > 2009/9/23 Abraham, Danny : >> Instead it returns the full count of the table. >> >> Any idea? >> >> Thanks >> >> Danny Abraham >> BMC Software >> C

[GENERAL] Re: PL/PG SQL: select count(*) into from where - does not compute the where cond

2009-09-23 Thread Abraham, Danny
... forgot the most import issue The problem shows when the selection is from a view. The where condition does not have names contention. It is: select count(*) into from where -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] How to have ant's task insert special chars appropriately?

2009-09-23 Thread Richard Huxton
agostonbejo wrote: > > Hi! > > What I'm trying to do is to insert some data from a sql file into a postgres > DB by calling the ant task. My problem is that I can't get special > characters (even if they can be represented by the standard ASCII charset, > such as ä, ö, ü, é, etc.) to be inserted

Re: [GENERAL] How to have ant's task insert special chars appropriately?

2009-09-23 Thread J. Roeleveld
On Wednesday 23 September 2009 11:29:02 Richard Huxton wrote: > agostonbejo wrote: > > Hi! > > > > What I'm trying to do is to insert some data from a sql file into a > > postgres DB by calling the ant task. My problem is that I can't get > > special characters (even if they can be represented by

[GENERAL] Re: PL/PG SQL: select count(*) into from where - does not compute the where cond - returns always total count

2009-09-23 Thread Abraham, Danny
Any idea? Thanks Danny -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Re: PL/PG SQL: select count(*) into from where - does not compute the where cond - returns always total count

2009-09-23 Thread A. Kretschmer
In response to Abraham, Danny : > Any idea? Apparently no, because nobody can reproduce your problem. See my other post, supplementary: test=*# create view view_o as select * from o; CREATE VIEW test=*# create or replace function my_count() returns int as $$declare c int;begin select into c cou

Re: [GENERAL] Where can I find detail information about constraint ?

2009-09-23 Thread Raymond O'Donnell
On 23/09/2009 11:23, 纪晓曦 wrote: > I want detail usage introduction about constraint,such as how to > constrain a string to be exactly 4 character and start with 'z'. > Where can I find the reference of CHECK? detail usage. Try the documentation, presumably under CREATE TABLE: http://www.postgre

Re: [GENERAL] How to have ant's task insert special chars appropriately?

2009-09-23 Thread Richard Huxton
J. Roeleveld wrote: > On Wednesday 23 September 2009 11:29:02 Richard Huxton wrote: >> agostonbejo wrote: >>> Hi! >>> >>> What I'm trying to do is to insert some data from a sql file into a >>> postgres DB by calling the ant task. My problem is that I can't get >>> special characters (even if they

[GENERAL] multiple calls to dblink_connect from within pl/pgSQL function exhaust connection limit

2009-09-23 Thread Peter Geoghegan
Hello, I'm writing a pl/pgSQL function that connects to multiple PostgreSQL databases and accumulates data from all of them into a temporary table. I use the dblink contrib module to do so. I loop through some records, form a connection string from those records, and do this: PERFORM dblink_conn

Re: [GENERAL] Re: PL/PG SQL: select count(*) into from where - does not compute the where cond - returns always total count

2009-09-23 Thread Martin Gainty
the "does not compute the where condition" needs more definition can you supply the table schema and which columns you want? select count(*) from table will get you the count We can banter on the need to store in views once the schema is known Martin Gainty

[GENERAL] Where can I find detail information about constraint ?

2009-09-23 Thread 纪晓曦
I want detail usage introduction about constraint,such as how to constrain a string to be exactly 4 character and start with 'z'.Where can I find the reference of CHECK? detail usage.

Re: [GENERAL] Graphical representation of query plans

2009-09-23 Thread Emi Lu
pgadmin does it pretty nicely: http://pgadmin.org/images/screenshots/pgadmin3_macosx.png As shown in the mackintosh version, it is a very nice and helpful feature! I have pgadmin 1.2.0 for PostgreSQL 8.0.15 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.2. I did not see this "explain" in

Re: [GENERAL] Where can I find detail information about constraint ?

2009-09-23 Thread Albe Laurenz
??? wrote: > I want detail usage introduction about constraint,such as how > to constrain a string to be exactly 4 character and start with 'z'. > Where can I find the reference of CHECK? detail usage. Documentation: http://www.postgresql.org/docs/current/static/ddl-constraints.html#AEN2254 The

Re: [GENERAL] How to have ant's task insert special chars appropriately?

2009-09-23 Thread Tom Lane
Richard Huxton writes: > J. Roeleveld wrote: >> Site is in dutch, but these characters are in the table headed "Extended >> ASCII >> Codes" > To the best of my knowledge there is no standard list of "extended ascii > codes" - Oh, there are plenty of them ;-). The OP's character set is most li

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Adrian Klaver
On Tuesday 22 September 2009 7:28:03 pm Joe Kramer wrote: > I have database backup schema+data in text (non-compressed) format. > Backup is created using "pg_dump -i -h ... -U ... -f dump.sql". > I run it with "psql > I can't use this text dump with pg_restore because it only accept > archived du

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Tom Lane
Joe Kramer writes: > I have database backup schema+data in text (non-compressed) format. > Backup is created using "pg_dump -i -h ... -U ... -f dump.sql". > I run it with "psql http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Joe Kramer
On Thu, Sep 24, 2009 at 12:02 AM, Adrian Klaver wrote: > On Tuesday 22 September 2009 7:28:03 pm Joe Kramer wrote: >> I have database backup schema+data in text (non-compressed) format. >> Backup is created using "pg_dump -i  -h ... -U ... -f dump.sql". >> I run it with "psql > >> I can't use this

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Joe Kramer
On Thu, Sep 24, 2009 at 12:53 AM, Tom Lane wrote: > Joe Kramer writes: >> I have database backup schema+data in text (non-compressed) format. >> Backup is created using "pg_dump -i  -h ... -U ... -f dump.sql". >> I run it with "psql > You sure they weren't disabled in the source database?  AFAIC

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Tom Lane
Joe Kramer writes: > On Thu, Sep 24, 2009 at 12:02 AM, Adrian Klaver wrote: >> What version of Postgres are you dumping from, restoring to? Which version of > I am using client 8.1.9 to dump from server 8.3.0 (unable to use client > 8.3.x) > Importing to server 8.3.7. You mean you are dumping

[GENERAL] Advance SQL subquery

2009-09-23 Thread AnthonyV
Hello, I have a table like : date|value --- 2009-09-19 | 1 2009-09-20 | 2 2009-09-21 | 6 2009-09-22 | 9 2009-09-23 | 1 I'd like a request which gives me the sum of each last n days. For example, if I want the sum of each 3 days,

Re: [GENERAL] Advance SQL subquery

2009-09-23 Thread Merlin Moncure
On Wed, Sep 23, 2009 at 8:13 AM, AnthonyV wrote: > Hello, > > I have a table like : > >   date        |    value > --- > 2009-09-19 |      1 > 2009-09-20 |      2 > 2009-09-21 |      6 > 2009-09-22 |      9 > 2009-09-23 |      1 > > I'd like a request which gives me the

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Tom Lane
Joe Kramer writes: > On Thu, Sep 24, 2009 at 12:53 AM, Tom Lane wrote: >> You sure they weren't disabled in the source database? > Yes, I'm absolutely sure they are not disabled. And in the SQL dump > file there are no commands that would disable them. Better take another look for "ALTER TABLE

[GENERAL]

2009-09-23 Thread Ms swati chande
Hi,   I am getting the following error while processing a query.   "server process was terminated by exception xc005"   Please help me resolve this.   Regards Swati

Re: [GENERAL]

2009-09-23 Thread Tom Lane
Ms swati chande writes: > I am getting the following error while processing a query. > "server process was terminated by exception xc005" What query, exactly? Which PG version is this? regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgre

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Joe Kramer
On Thu, Sep 24, 2009 at 1:33 AM, Tom Lane wrote: > Joe Kramer writes: >> On Thu, Sep 24, 2009 at 12:53 AM, Tom Lane wrote: >>> You sure they weren't disabled in the source database? > >> Yes, I'm absolutely sure they are not disabled. And in the SQL dump >> file there are no commands that would

[GENERAL] Source for CreatedSharedMemoryAndSemaphores

2009-09-23 Thread Martin Gainty
Hello All experiencing a problem with build not finding function CreatedSharedMemoryAndSemaphores any ideas to locate source and or build files for CreatedSharedMemoryAndSemaphores would be appreciated thanks! Martin Gainty __ Verzicht und Vertrau

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Adrian Klaver
- "Joe Kramer" wrote: > On Thu, Sep 24, 2009 at 1:33 AM, Tom Lane wrote: > > Joe Kramer writes: > >> On Thu, Sep 24, 2009 at 12:53 AM, Tom Lane > wrote: > >>> You sure they weren't disabled in the source database? > > > >> Yes, I'm absolutely sure they are not disabled. And in the SQL > d

Re: [GENERAL] Source for CreatedSharedMemoryAndSemaphores

2009-09-23 Thread Tom Lane
Martin Gainty writes: > experiencing a problem with build not finding function > CreatedSharedMemoryAndSemaphores Typo? Should be CreateSharedMemoryAndSemaphores. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes t

Re: [GENERAL] Advance SQL subquery

2009-09-23 Thread AnthonyV
On 23 sep, 17:32, mmonc...@gmail.com (Merlin Moncure) wrote: > On Wed, Sep 23, 2009 at 8:13 AM, AnthonyV wrote: > > Hello, > > > I have a table like : > > >   date        |    value > > --- > > 2009-09-19 |      1 > > 2009-09-20 |      2 > > 2009-09-21 |      6 > > 2009

Re: [GENERAL] Advance SQL subquery

2009-09-23 Thread David Fetter
On Wed, Sep 23, 2009 at 05:13:34AM -0700, AnthonyV wrote: > Hello, > > I have a table like : > >date|value > --- > 2009-09-19 | 1 > 2009-09-20 | 2 > 2009-09-21 | 6 > 2009-09-22 | 9 > 2009-09-23 | 1 > > I'd like a request which

Re: [GENERAL] Help! Database restored with disabled triggers

2009-09-23 Thread Scott Marlowe
On Wed, Sep 23, 2009 at 9:12 AM, Joe Kramer wrote: > I am using client 8.1.9 to dump from server 8.3.0  (unable to use client > 8.3.x) > Importing to server 8.3.7. That won't work -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http:/

Re: [GENERAL] Source for CreatedSharedMemoryAndSemaphores

2009-09-23 Thread Martin Gainty
yep its in /backend/storage/ipci/ipci.c for some reason after i compile backend and try to link postgres i'm missing ipci.o ? i'll append into ipci.o into OBJS and give it a go Thanks Tom! Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note

Re: [GENERAL] Source for CreatedSharedMemoryAndSemaphores

2009-09-23 Thread Tom Lane
Martin Gainty writes: > for some reason after i compile backend and > try to link postgres i'm missing ipci.o ? > i'll append into ipci.o into OBJS and give it a go I'd be really surprised if just that one file is missing; I think you must have some bigger problem. Maybe you are running into co

Re: [GENERAL] multiple calls to dblink_connect from within pl/pgSQL function exhaust connection limit

2009-09-23 Thread Tom Lane
Peter Geoghegan writes: > I use the dblink contrib module to do so. I loop through some records, > form a connection string from those records, and do this: > PERFORM dblink_connect(conn_str); > > Making many successive calls to this function of mine eventually > exhausts the connection lim

Re: [GENERAL] pgadmin is changing pgpass.conf

2009-09-23 Thread Howard Cole
Richard Huxton wrote: Raymond O'Donnell wrote: On 18/09/2009 16:07, Howard Cole wrote: Thanks for the update. Unfortunately this behaviour has the side effect of deleting passwords that I have set up in the file manually for other applications (namely the backup), which runs under the

Re: [GENERAL] Source for CreatedSharedMemoryAndSemaphores

2009-09-23 Thread Martin Gainty
hard dependency on the 1.4 IPC library (remember the old days when you used to have load the 7 layer stack one at a time) (un)fortunately im running thru cygwin and the cygipc 1.4 library is missing or at least i cant find it whats more some of the cygwin binaries have the MZ (mark zibikowski)

Re: [GENERAL] multiple calls to dblink_connect from within pl/pgSQL function exhaust connection limit

2009-09-23 Thread Peter Geoghegan
Hi Tom, > What PG version is this?  8.4 has a connection leak in some cases: > http://archives.postgresql.org/pgsql-committers/2009-09/msg00125.php > > This fix hasn't made any released version yet, but you could apply the > source patch shown there. This is 8.4.0 on Windows. Looks like it's the

[GENERAL] Looking for way to replicate master db to multiple mobile databases

2009-09-23 Thread Bryan Montgomery
Hi, I'm looking for a way to replicate am master database to multiple (100+) databases that are taken in to the field. Currently for each laptop we dump and load the tables. However,there is only a small percentage of data that changes on a frequent basis. I've been looking around and come across

[GENERAL] grants on pg_stats_activity

2009-09-23 Thread JC Praud
Hi all, I'm trying to monitor databases with munin. For security reasons I guess it is better to create a specialized user "munin" or like that and grant it only the necessary rights: no superuser rights, nor write access on my applications databases. My problem is, this user cannot access to inf

[GENERAL] More straight forward method to convert seconds::bigint to interval

2009-09-23 Thread Shane R. Spencer
I work in VoIP. HMS (Hour/Minute/Second) format appears to be the rule when working with call time totals. I admit it makes some reports easier to read. The method I used to convert a int/bigint to HMS (or the standard representation of an interval type) is as follows: select (123456.789::varch

Re: [GENERAL] More straight forward method to convert seconds::bigint to interval

2009-09-23 Thread Tom Lane
"Shane R. Spencer" writes: > Is there a less string oriented method of converting seconds as an int > to an interval? Multiply by an interval, eg 123456.789 * interval '1 second' It works, it's fast, and you can use any scale factor you want. regards, tom lane

Re: [GENERAL] More straight forward method to convert seconds::bigint to interval

2009-09-23 Thread Adam Rich
Shane R. Spencer wrote: I work in VoIP. HMS (Hour/Minute/Second) format appears to be the rule when working with call time totals. I admit it makes some reports easier to read. The method I used to convert a int/bigint to HMS (or the standard representation of an interval type) is as follows:

Re: [GENERAL] Looking for way to replicate master db to multiple mobile databases

2009-09-23 Thread Scott Marlowe
On Wed, Sep 23, 2009 at 11:11 AM, Bryan Montgomery wrote: > Hi, > I'm looking for a way to replicate am master database to multiple (100+) > databases that are taken in to the field. Currently for each laptop we dump > and load the tables. However,there is only a small percentage of data that > ch

[GENERAL] Possible Bug - error creating a tablespace

2009-09-23 Thread Kevin Kempter
So I think I *may* have found a bug but I want to be sure before I file a bug. I did a search on the pgsql-bugs list using the search text: cannot create tablespace and got nothing back. Here's the scenario: 1) we installed CentOS 5.3 x86_64 on a 64bit Dell server 2) I installed the pgdg_ce

Re: [GENERAL] Possible Bug - error creating a tablespace

2009-09-23 Thread Tom Lane
Kevin Kempter writes: > 4) Here's the weird part: > -- If I start the cluster via "sudo /etc/init.d/postgres start" and then try > and create a tablespace it fails with : > create tablespace benchmark2 location '/eq5/pwbbench'; > ERROR: could not set permissions on directory "/eq5/pwbbench": Pe

Re: [GENERAL] More straight forward method to convert seconds::bigint to interval

2009-09-23 Thread Shane Spencer
Well worth joining the list. Thanks guys. On Wed, Sep 23, 2009 at 12:48 PM, Adam Rich wrote: > Shane R. Spencer wrote: >> >> I work in VoIP.  HMS (Hour/Minute/Second) format appears to be the rule >> when working with call time totals.  I admit it makes some reports >> easier to read. >> >> The

Re: [GENERAL] How to get variable out to shell script

2009-09-23 Thread Greg Smith
On Sun, 20 Sep 2009, Abel Camarillo wrote: #!/bin/sh dbname= user= password= In general it's better to use the .pgpass/PGPASSFILE mechanism: http://www.postgresql.org/docs/current/static/libpq-pgpass.html to cache passwords like this, if you can't eliminate the need for them altogether thro

[GENERAL] lazy vacuum and AccessExclusiveLock

2009-09-23 Thread Jaromír Talíř
Hello, we are facing strange situation with exclusively locked table during normal lazy vacuum. There is one big table (66GB) that is heavily inserted and updated in our database. Suddenly (after backup and delete of almost all records) we are not able to run VACUUM over this table because after 5

[GENERAL] Log File Melancholy

2009-09-23 Thread Jerry LeVan
Hi, I have two Snow Leopard installations, a macbook pro and a mac mini. Whenever I start the postgresql system on the mbp the log shows: LOG: received smart shutdown request LOG: shutting down LOG: database system is shut down could not lookup DNS configuration info service: (ipc/send) inva

Re: [GENERAL] Log File Melancholy

2009-09-23 Thread Tom Lane
Jerry LeVan writes: > could not lookup DNS configuration info service: (ipc/send) invalid > destination port > LOG: could not resolve "localhost": nodename nor servname provided, > or not known > LOG: disabling statistics collector for lack of working socket > I cannot figure out where the

Re: [GENERAL] Possible Bug - error creating a tablespace

2009-09-23 Thread Gabriel Ramirez
On 09/23/2009 04:30 PM, Tom Lane wrote: > Kevin Kempter writes: >> 4) Here's the weird part: >> -- If I start the cluster via "sudo /etc/init.d/postgres start" and then try >> and create a tablespace it fails with : > >> create tablespace benchmark2 location '/eq5/pwbbench'; >> ERROR: could not

Re: [GENERAL] Idle processes chewing up CPU?

2009-09-23 Thread Brendan Hill
Hi Tom, Makes sense to me. Seems to be happening rarely now. I'm not all that familiar with the open source process, is this likely to be included in the next release version? -Brendan -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Monday, 21 September 2009 5:25 A