Re: [GENERAL] Check if column is substring of another column

2009-01-21 Thread Richard Huxton
Keaton Adams wrote: > PostgreSQL 8.1 question: > > I have two columns. > policyNumber contains a 12-13 varchar string > AllPolicyNumbersIncluded contains one or more 12-13 varchar strings (policy > nums) separated by commas Rodrigo has given a direct answer, but you might want to consider either

Re: [GENERAL] autovacuum daemon

2009-01-21 Thread Abdul Rahman
Thanks Ray, Your solution of using ps command is for Linux but I am using WinXp. That is why it confused me. Regards, Abdul Rehman.

Re: [GENERAL] autovacuum daemon

2009-01-21 Thread Abdul Rahman
Dear All, Thanks for fruitful replies. But I checked it by running ANALYZE on psql. First updated 1 rows in a table and got certain number of dead rows in result of ANALYZE. After few minutes the number of dead rows becomes zero which assured me that AUTOVACUUM is running in background. No

Re: [GENERAL] Check if column is substring of another column

2009-01-21 Thread Rodrigo E . De León Plicet
On Wed, Jan 21, 2009 at 5:44 PM, Keaton Adams wrote: > Is there a way to do this in a single SQL statement in PostgreSQL 8.1? SELECT d.policyNumber , d.CompanyName , d.Address , p.AllPolicyNumbersIncluded FROM PolicyPrint p INNER JOIN PolicyDetails d ON ( p.cicPolicyNumber =

[GENERAL] Check if column is substring of another column

2009-01-21 Thread Keaton Adams
PostgreSQL 8.1 question: I have two columns. policyNumber contains a 12-13 varchar string AllPolicyNumbersIncluded contains one or more 12-13 varchar strings (policy nums) separated by commas I want to check if policyNumber is contained in AllPolicyNumbersIncluded. In SQL Server the PATINDEX fu

Re: [GENERAL] [Plproxy-users] A complex plproxy query

2009-01-21 Thread Hannu Krosing
On Thu, 2009-01-22 at 02:33 +0300, Igor Katson wrote: > So to say, give me the list of friends (not only their ID's, but all the > needed columns!) of given individual, which are in a given group. That > seems ok without plproxy, but with using it, I can't imagine how can I > form a nice query,

Re: [GENERAL] encoding of PostgreSQL messages

2009-01-21 Thread Bruce Momjian
Added to TODO: Improve encoding of connection startup messages sent to the client Currently some authentication error messages are sent in the server encoding * http://archives.postgresql.org/pgsql-general/2008-12/msg00801.php

Re: [GENERAL] Automatic CRL reload

2009-01-21 Thread Bruce Momjian
Alvaro Herrera wrote: > Andrej Podzimek wrote: > > > "The files server.key, server.crt, root.crt, and root.crl are only > > examined during server start; so you must restart the server for > > changes in them to take effect." > > (http://www.postgresql.org/docs/8.3/static/ssl-tcp.html) > > > > Thi

[GENERAL] A complex plproxy query

2009-01-21 Thread Igor Katson
This is a complex question, and I couldn't form it in a short and easy way, and I'm sorry for that. First of all, let me introduce you to the DB (to form a question), for you to understand what am I talking about. The module looks like a social network, just the users have friends, which can b

Re: [GENERAL] how to implement a foreign key type constraint against a not unique column

2009-01-21 Thread Richard Broersma
On Wed, Jan 21, 2009 at 12:53 PM, Brent Wood wrote: > I believe it is possible by using a table with nulls for the -1 values with a > unique index on it as the foreign key, then a view which uses case or > coalesce to present the nulls as -1, but this seems a cumbersome workaround. This will w

[GENERAL] how to implement a foreign key type constraint against a not unique column

2009-01-21 Thread Brent Wood
Hi, I have a table with a column of ID's (integer), these are unique except where they = -1 (column 1) I have a partial unique index where the value is not -1 to enforce this. I want to use this column as a foreign key on a column in another table (column 2), but cannot without a full unique in

Re: [GENERAL] Custom type, operators and operator class not sorting/indexing correctly

2009-01-21 Thread Martijn van Oosterhout
On Wed, Jan 21, 2009 at 10:48:09AM +, Roger Leigh wrote: > Ah, thanks for the clarification. So I need to use CREATE TYPE > rather than CREATE DOMAIN. Because I'm essentially just storing > a text string with different operators, can I derive a type from > TEXT (perhaps by reusing the same in

[GENERAL] Followup: Here's why I want to use connection pooling middleware!

2009-01-21 Thread Kirk Strauser
On Thursday 15 January 2009 09:54:50 Kirk Strauser wrote: > I have a PostgreSQL 8.3.5 server with max_connections = 400. At this > moment, I have 223 open connections, including 64 from a bunch of > webserver processes and about 100 from desktop machines running a > particular application. The re

Re: [GENERAL] how to find foreign key details (column, that is)

2009-01-21 Thread Karsten Hilbert
On Wed, Jan 21, 2009 at 01:49:44PM -0500, Bruce Momjian wrote: > Tom Lane wrote: > > Karsten Hilbert writes: > > > This is what my 8.3 manual says: > > > > > conkey │ int2[] │ pg_attribute.attnum │ If a table constraint, list of > > > columns which the constraint constrains │ > > > > > From th

Re: [GENERAL] how to find foreign key details (column, that is)

2009-01-21 Thread Bruce Momjian
Tom Lane wrote: > Karsten Hilbert writes: > > This is what my 8.3 manual says: > > > conkey ??? int2[] ??? pg_attribute.attnum ??? If a table constraint, list > > of columns which the constraint constrains ??? > > > From that I wouldn't have figured it'd apply to foreign keys > > as well. So I

Re: [GENERAL] deductive databases in postgreSQL

2009-01-21 Thread Grzegorz Jaśkiewicz
On Wed, Jan 21, 2009 at 6:09 PM, Carlos Gonzalez-Cadenas wrote: > If not, what do you think is the best and most efficient way of implementing > it? > > Thank you very much in advance, > I think you should ask that sort of quesitons on -hackers list, not here. -- GJ -- Sent via pgsql-genera

Re: [GENERAL] Database schema & data synchronizer software for PostgreSQL?

2009-01-21 Thread David Fetter
On Wed, Jan 21, 2009 at 05:18:57AM +0100, Együd Csaba wrote: > >From: David Fetter [mailto:da...@fetter.org] > >On Tue, Jan 20, 2009 at 03:03:33PM +0100, Csaba Együd wrote: > >> Hi, > >> I'd like to ask your suggestions about a reliable admin software > >> which is able to compare two dabases and g

[GENERAL] deductive databases in postgreSQL

2009-01-21 Thread Carlos Gonzalez-Cadenas
Hi all, We're looking for a deductive database for our application. Oracle, in the 11g version, has extended its RDBMS with deductive capabilities, supporting a subset of OWL-DL[1]. They are able to load an ontology, perform the inferences, dump the inferred info in the database and after that ans

Re: [GENERAL] Problem with retrieving records using double precision fields

2009-01-21 Thread Raymond C. Rodgers
Richard Huxton wrote: Raymond C. Rodgers wrote: In two separate databases that are configured to have latitude and longitude as double precision fields, I'm having trouble retrieving records using "between" on the longitude field. I know that I have data within range, but any query involving

Res: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread paulo matadr
The size of object depend on report for a user request, shared_buffers = 2048MB work_mem = 12MB --- Server conf 16 GB RAM Red Hat Enterprise Linux Server release 5 Using apliccation web based , with Jboss apliccation server on jdbc driver. Lets see scenario : Apliccation request a report,i

Re: [GENERAL] Problem with retrieving records using double precision fields

2009-01-21 Thread Richard Huxton
Raymond C. Rodgers wrote: > In two separate databases that are configured to have latitude and > longitude as double precision fields, I'm having trouble retrieving > records using "between" on the longitude field. I know that I have data > within range, but any query involving the longitude field

Re: [GENERAL] Problem with retrieving records using double precision fields

2009-01-21 Thread Sam Mason
On Wed, Jan 21, 2009 at 12:22:14PM -0500, Raymond C. Rodgers wrote: > test=# select * from coordtest where latitude between 42.0 and 42.5 ; The LHS value of a BETWEEN operator has to be of smaller value than the RHS's value. You've got it correct above, but it's not correct here: > test=# select

[GENERAL] Problem with retrieving records using double precision fields

2009-01-21 Thread Raymond C. Rodgers
In two separate databases that are configured to have latitude and longitude as double precision fields, I'm having trouble retrieving records using "between" on the longitude field. I know that I have data within range, but any query involving the longitude field fails to find records. Here'

Re: [GENERAL] How to find how much postgresql use the memory?

2009-01-21 Thread Albe Laurenz
Luki Rustianto wrote: > Ok I see. So what's the best way to find optimum value for > various memory-related setting of postgresql ? How much memory is there in the machine? Are there other programs running or is the machine dedicated to the database? Are the queries you run complicated (order / h

Re: [GENERAL] bytea size limit?

2009-01-21 Thread Albe Laurenz
paulo matadr wrote: > I everyone, need help!!! > My aplication return erro: > > 2009-01-20 10:22:03,264 INFO [STDOUT] Caused by: org.postgresql.util. > PSQLException: ERROR: invalid memory alloc request size 1705447581 > > > TABLE batch.relatorio_gerado > > rege_id integer NOT NULL, > fu

Re: [GENERAL] Slow update

2009-01-21 Thread Herouth Maoz
Grzegorz Jaśkiewicz wrote: > On Wed, Jan 21, 2009 at 12:55 PM, Herouth Maoz wrote: > >> Well, if it executes the query it's a problem. I might be able to do so >> during the weekend, when I can play with the scripts and get away with >> failures, but of course there is less data in the tables

Re: [GENERAL] Slow update

2009-01-21 Thread Sam Mason
On Wed, Jan 21, 2009 at 02:55:00PM +0200, Herouth Maoz wrote: > Filip Rembiakowski wrote: > > 2. can you post results of EXPLAIN ANALYZE (please note it actually > > executes the query)? > > Well, if it executes the query it's a problem. You can wrap an EXPLAIN ANALYSE up in BEGIN;...ROLLBACK;.

Re: [GENERAL] autovacuum daemon

2009-01-21 Thread Sam Mason
[ Grzegorz, please include some context ] On Wed, Jan 21, 2009 at 03:01:39PM +, Grzegorz Jaaakiewicz wrote: > Avdul Rehman wrote: > > I have set postgresql.conf for autovacuum and need to know weather > > the process is running/working or not. > > select * from pg_autovacuum; This won't do

Re: [GENERAL] Slow update

2009-01-21 Thread Grzegorz Jaśkiewicz
On Wed, Jan 21, 2009 at 12:55 PM, Herouth Maoz wrote: > Well, if it executes the query it's a problem. I might be able to do so > during the weekend, when I can play with the scripts and get away with > failures, but of course there is less data in the tables then. > you should seirously think ab

Re: [GENERAL] Slow update

2009-01-21 Thread Filip Rembiałkowski
2009/1/21 Herouth Maoz > Hello. > > I have a daily process that synchronizes our reports database from our > production databases. In the past few days, it happened a couple of times > that an update query took around 7-8 hours to complete, which seems a bit > excessive. This is the query: > >

Re: [GENERAL] autovacuum daemon

2009-01-21 Thread Grzegorz Jaśkiewicz
select * from pg_autovacuum; -- GJ -- 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] Odd array issue

2009-01-21 Thread Craig Ringer
Tom Lane wrote: > Craig Ringer writes: >> The following query should return 2 records, but returns zero instead: > >> test=> select x, regexp_matches(x::text, 'm') >> test-> FROM generate_series(1,2) AS x; >> x | regexp_matches >> ---+ >> (0 rows) > > No, that's correct. The SR

Re: [GENERAL] bytea size limit?

2009-01-21 Thread Merlin Moncure
On 1/21/09, paulo matadr wrote: > > I everyone, need help!!! > My aplication return erro: > > 2009-01-20 10:22:03,264 INFO [STDOUT] Caused by: org.postgresql.util. > PSQLException: ERROR: invalid memory alloc request size 1705447581 What exactly were you doing when you got the error? How big is

Re: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread Kenneth Marshall
On Wed, Jan 21, 2009 at 03:07:13PM +, Grzegorz Ja??kiewicz wrote: > On Wed, Jan 21, 2009 at 3:02 PM, paulo matadr wrote: > > My system have very large ram size, so its possible review postgresql.conf ? > > > all depends on how you access DB, what type of drivers (odbc, libpq, etc, > etc). > S

Re: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread Grzegorz Jaśkiewicz
On Wed, Jan 21, 2009 at 3:02 PM, paulo matadr wrote: > My system have very large ram size, so its possible review postgresql.conf ? > all depends on how you access DB, what type of drivers (odbc, libpq, etc, etc). See, every time you pass a row , they usually have to allocate that much memory, not

Re: [GENERAL] autovacuum daemon

2009-01-21 Thread Andreas Wenk
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Abdul Rahman schrieb: > Deal All, > > I have set postgresql.conf for autovacuum and need to know weather the > process is running/working or not. Hi Abdul, 1. you could check the log file 2. select setting from pg_settings where name = 'autovacuum'

Res: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread paulo matadr
My system have very large ram size, so its possible review postgresql.conf ? De: Kenneth Marshall Para: Grzegorz Ja??kiewicz Cc: paulo matadr ; pgsql-general@postgresql.org; admin Enviadas: Quarta-feira, 21 de Janeiro de 2009 11:06:23 Assunto: Re: [ADMIN] [GEN

Re: [GENERAL] autovacuum daemon

2009-01-21 Thread Raymond O'Donnell
On 21/01/2009 14:57, Raymond O'Donnell wrote: > On 21/01/2009 07:47, Abdul Rahman wrote: > >> I have set postgresql.conf for autovacuum and need to know weather >> the process is running/working or not. > > ps ax | grep postgres Also, in psql: postgres=# show autovacuum; autovacuum ---

Re: [GENERAL] autovacuum daemon

2009-01-21 Thread Raymond O'Donnell
On 21/01/2009 07:47, Abdul Rahman wrote: > I have set postgresql.conf for autovacuum and need to know weather > the process is running/working or not. ps ax | grep postgres Ray. -- Raymond O'Donnell, Director of Music, Galway Cath

[GENERAL] autovacuum daemon

2009-01-21 Thread Abdul Rahman
Deal All, I have set postgresql.conf for autovacuum and need to know weather the process is running/working or not. Regards, Avdul Rehman.

Re: [GENERAL] Odd array issue

2009-01-21 Thread Tom Lane
Craig Ringer writes: > The following query should return 2 records, but returns zero instead: > test=> select x, regexp_matches(x::text, 'm') > test-> FROM generate_series(1,2) AS x; > x | regexp_matches > ---+ > (0 rows) No, that's correct. The SRF returns an empty set, so the

[GENERAL] Odd array issue

2009-01-21 Thread Craig Ringer
Hi folks While debugging a query that was returning far fewer records than expected, I narrowed the issue down to what I think might be a Pg bug. I thought I'd check here in case I'm just missing something obvious before sending anything to the bugs list. test=> select version();

Re: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread Grzegorz Jaśkiewicz
you don't have to quote everything :) I ment, there's nothing on bytea on its doc page, where one would expect to read it. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread Kenneth Marshall
On Wed, Jan 21, 2009 at 02:09:01PM +, Grzegorz Ja??kiewicz wrote: > On Wed, Jan 21, 2009 at 2:06 PM, Kenneth Marshall wrote: > > > The TOAST implementation however only allows 30-bits for the > > size of the TOAST entry which caps the size at 2^30 or 1GB. I > > agree that he could very well b

Re: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread Grzegorz Jaśkiewicz
On Wed, Jan 21, 2009 at 2:06 PM, Kenneth Marshall wrote: > The TOAST implementation however only allows 30-bits for the > size of the TOAST entry which caps the size at 2^30 or 1GB. I > agree that he could very well be limited also by the memory on > his system. i wasn't aware of that, and also

Re: [ADMIN] [GENERAL] bytea size limit?

2009-01-21 Thread Kenneth Marshall
On Wed, Jan 21, 2009 at 01:55:28PM +, Grzegorz Ja??kiewicz wrote: > there's no real limit (its size is described with 32bit number, and > that's the only limitation here). > But you need to be aware, that content is sent over at once, so memory > is the limit in your case. > > http://www.postg

Re: [GENERAL] bytea size limit?

2009-01-21 Thread Grzegorz Jaśkiewicz
there's no real limit (its size is described with 32bit number, and that's the only limitation here). But you need to be aware, that content is sent over at once, so memory is the limit in your case. http://www.postgresql.org/docs/8.3/static/datatype-binary.html For such large objects, it might b

Re: [GENERAL] [ADMIN] bytea size limit?

2009-01-21 Thread Kenneth Marshall
On Wed, Jan 21, 2009 at 05:21:03AM -0800, paulo matadr wrote: > I everyone, need help!!! > My aplication return erro: > > 2009-01-20 10:22:03,264 INFO [STDOUT] Caused by: org.postgresql.util. > PSQLException: ERROR: invalid memory alloc request size 1705447581 > > TABLE batch.relatorio_gerado >

[GENERAL] bytea size limit?

2009-01-21 Thread paulo matadr
I everyone, need help!!! My aplication return erro: 2009-01-20 10:22:03,264 INFO [STDOUT] Caused by: org.postgresql.util. PSQLException: ERROR: invalid memory alloc request size 1705447581 TABLE batch.relatorio_gerado rege_id integer NOT NULL, fuin_id integer NOT NULL, rela_id integer NO

Re: [GENERAL] Slow update

2009-01-21 Thread Herouth Maoz
Filip Rembiałkowski wrote: > > 1. which postgres version? 8.3.1 > 2. can you post results of EXPLAIN ANALYZE (please note it actually > executes the query)? > Well, if it executes the query it's a problem. I might be able to do so during the weekend, when I can play with the scripts and get away

Re: [GENERAL] Get object creation sql script in psql client

2009-01-21 Thread Jasen Betts
On 2009-01-20, Igor Katson wrote: > Is there a way to get i.e. table creation sql script from an existing > table in psql (not postgresql, but psql client), like it is in pgAdmin? > > I.e. i point it to existing table 'foo', and it writes: > CREATE TABLE foo ( >bar int > ); pg_dump dbname --

Re: [GENERAL] import sql dump with psql - language creation throws error

2009-01-21 Thread Jasen Betts
On 2009-01-20, Andreas Wenk wrote: > > Hi everybody, > > I have an automated mechanism to restore a demo database each night with an > SQL dump. What > I do inbetween a shell script is the following: > > 1. all database access is canceled > 2. dropdb > 3. createdb > 4. import SQL dump: psql -o /d

Re: [GENERAL] Slow update

2009-01-21 Thread Herouth Maoz
Marc Mamin wrote: > Hello, > > - did you vacuum your tables recently ? > > - What I miss in your query is a check for the rows that do not need > to be udated: > > AND NOT (service = b.service >AND status = b.status > AND has_notification = gateway_id NOT IN (4,

Re: [GENERAL] Slow update

2009-01-21 Thread Marc Mamin
Hello, - did you vacuum your tables recently ? - What I miss in your query is a check for the rows that do not need to be udated: AND NOT (service = b.service AND status = b.status AND has_notification = gateway_id NOT IN (4,101,102) AND operator =

Re: [GENERAL] Custom type, operators and operator class not sorting/indexing correctly

2009-01-21 Thread Roger Leigh
On Wed, Jan 21, 2009 at 02:03:03AM -0500, Tom Lane wrote: > Roger Leigh writes: > > I've created a new domain (debversion) derived from TEXT, which > > includes its own operators (< <= = >= > and <>), and also its > > own operator class for BTREE indices. > > You can't realistically attach such t

Re: [GENERAL] pg_restore: [archiver] entry ID -825110830 out of range -- perhaps a corrupt TOC

2009-01-21 Thread Andreas Wenk
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dennis C schrieb: > OK that was it! Wow, thank you so very much! Nice to know it was just > plpython tracking such an obsolete version of postgresql much to my > dismay now (especially even going backwards, which didn't even occur to > me), as oppose

[GENERAL] Slow update

2009-01-21 Thread Herouth Maoz
Hello. I have a daily process that synchronizes our reports database from our production databases. In the past few days, it happened a couple of times that an update query took around 7-8 hours to complete, which seems a bit excessive. This is the query: UPDATE rb SET service = b.service