Re: [GENERAL] Reserve one row for every distinct value in a column

2012-05-16 Thread Chris Angelico
On Wed, May 16, 2012 at 4:53 PM, wrote: > Hi! I am trying to implement a mechanism to reserve the last row for every > distinct value in column "c1". Take a step back. Why are you needing to preserve these rows? This smells like a likely target for normalization. Put your unique values for c1 i

Re: [GENERAL] vacuum, vacuum full and problems releasing disk space

2012-05-16 Thread Horaci Macias
after tuning the autovacuum settings I can now see the tables vaccumed and the number of dead tuples dropping whenever an autovacuum happens, which makes sense. What I don't see though is the size of the tables ever decreasing, but I'm not sure I should see this. Can somebody please confirm wh

Re: [GENERAL] Naming conventions

2012-05-16 Thread Raymond O'Donnell
On 15/05/2012 22:50, Scott Briggs wrote: > So this is purely anecdotal but I'm curious, what's with all the > different naming conventions? There's psql (for database > connections), pgsql (used for some dirs like /usr/pgsql-9.1 and this > mailing list), postgres (user and other references), and p

Re: [GENERAL] archive_command and streaming replication

2012-05-16 Thread Albe Laurenz
Scott Briggs wrote: > Hi, can someone please explain the purpose of archive_command on both > the master and slave when it comes to streaming replication? From > what I understand so far, what really matters is how many pg_xlog > files are kept when it comes to reestablishing replication when it >

[GENERAL] missing pg_clog files after pg_upgrade

2012-05-16 Thread Christian J. Dietrich
Hey all, I have a problem which I speculate to be due to the pg_upgrade bug [1]: ERROR: could not access status of transaction 13636 DETAIL: could not open file "pg_clog/": No such file or directory The pg_clog directory contains files with names in the range from 004A to 0105. 004A dates J

Re: [GENERAL] vacuum, vacuum full and problems releasing disk space

2012-05-16 Thread Albe Laurenz
Horaci Macias wrote: > after tuning the autovacuum settings I can now see the tables vaccumed > and the number of dead tuples dropping whenever an autovacuum happens, > which makes sense. Great. > What I don't see though is the size of the tables ever decreasing, but > I'm not sure I should see t

Re: [GENERAL] vacuum, vacuum full and problems releasing disk space

2012-05-16 Thread Horaci Macias
thanks Laurenz, at least this confirms the big size is not an issue. Regarding % of dead tuples vs live tuples, I haven't tried it but apparently pgstattuple, from contribs should do that, just in case anybody reading had the same question. thanks, H On 16/05/12 14:41, Albe Laurenz wrote:

Re: [GENERAL] vacuum, vacuum full and problems releasing disk space

2012-05-16 Thread Merlin Moncure
On Thu, May 10, 2012 at 9:42 AM, Guy Helmer wrote: > On May 10, 2012, at 4:31 AM, Horaci Macias wrote: > >> Hi everybody, >> >> I'm running postgres 9.1 and having disk space problems. >> My application captures information 24x7 and stores it into the database. >> This includes several bytea and

[GENERAL] casting behavior of oids and relation names

2012-05-16 Thread salah jubeh
Hello guys, In some cases when I cast the oid to relation names (''::regclass::text)  I get  schemaname.tablename and in some cases I just get tablename. I thought at the beginning, this is due name duplication of tables in different schemas but it seems not.  Also, this seems as a schema o

Re: [GENERAL] casting behavior of oids and relation names

2012-05-16 Thread Tom Lane
salah jubeh writes: > In some cases when I cast the oid to relation names (''::regclass::text)   > I get  schemaname.tablename and in some cases I just get tablename. I thought > at the beginning, this is due name duplication of tables in > different schemas but it seems not.  Also, this see

Re: [GENERAL] casting behavior of oids and relation names

2012-05-16 Thread Vibhor Kumar
On May 16, 2012, at 9:20 AM, salah jubeh wrote: > > In some cases when I cast the oid to relation names (''::regclass::text) > I get schemaname.tablename and in some cases I just get tablename. I thought > at the beginning, this is due name duplication of tables in different schemas > b

[GENERAL] maybe incorrect regexp_replace behavior in v8.3.4 ?

2012-05-16 Thread Gauthier, Dave
Hi: bi_hsx_a0_latest=# select regexp_replace('xxx','^xxx$','abc'); regexp_replace abc (1 row) expected behavior because there's a match bi_hsx_a0_latest=# select regexp_replace('xxx','^xxxy$','abc'); regexp_replace xxx (1 row) expected because there is no match

Re: [GENERAL] maybe incorrect regexp_replace behavior in v8.3.4 ?

2012-05-16 Thread Richard Huxton
On 16/05/12 14:54, Gauthier, Dave wrote: bi_hsx_a0_latest=# select regexp_replace('xxx','^xxxy$',null); regexp_replace (1 row) But why did it return null in this case? I would think no match would leave it 'xxx'. If a function is defined as "strict" then any null parameters

Re: [GENERAL] maybe incorrect regexp_replace behavior in v8.3.4 ?

2012-05-16 Thread Tom Lane
"Gauthier, Dave" writes: > bi_hsx_a0_latest=# select regexp_replace('xxx','^xxxy$',null); > regexp_replace > > > (1 row) > But why did it return null in this case? regexp_replace is strict, so it never even gets called when there's a null input. regards,

Re: [GENERAL] Slow queries when functions are inlined

2012-05-16 Thread Tom Lane
Evan Martin writes: > I've run into a weird query performance problem. I have a large, complex > query which joins the results of several set-returning functions with > some tables and filters them by calling another function, which involves > PostGIS calls (ST_DWithin). This used to run in abo

[GENERAL] Query regarding Intersect clause

2012-05-16 Thread Ajit Pradnyavant
Sir, I have created the following tables, Create table abc (srno int, name varchar(32)) Create table def (srno int, name varchar(32)) abc srnoname 1 Aaaa 2 Bbbb def srnoname 1 Aaaa 2 Cccc each having two tuples. If I run the following query I get the fo

Re: [GENERAL] Slow queries when functions are inlined

2012-05-16 Thread Evan Martin
Thanks, Tom. You mean this bit, right? -> Seq Scan on _test_pos (cost=0.00..10728.00 rows=1 width=4) Filter: ((('010120E6101C401C40'::geography && _st_expand(pos, 30::double precision)) AND ... I tried to find some info on selectivity estimation f

Re: [GENERAL] Query regarding Intersect clause

2012-05-16 Thread Tom Lane
Ajit Pradnyavant writes: > I think result of INTERSECT ALL query may be : > Srno Name > 1 Aaaa > 1 Aaaa > Because intersect all clause returns the duplicate values. No; per the documentation at http://www.postgresql.org/docs/9.1/static/sql-select.html#SQL-INTERSECT The result

Re: [GENERAL] Slow queries when functions are inlined

2012-05-16 Thread Tom Lane
Evan Martin writes: > Thanks, Tom. You mean this bit, right? > -> Seq Scan on _test_pos (cost=0.00..10728.00 rows=1 width=4) > Filter: > ((('010120E6101C401C40'::geography && > _st_expand(pos, 30::double precision)) AND ... > I tried to find some i

[GENERAL] Libpq question

2012-05-16 Thread John Townsend
It appears that some developers (Davart) are by-passing the standard client library, “libpq.dll”, and directly accessing the server using Delphi or FPC. I am not sure of the advantage here. All libpq.dll functions can be called from Delphi or FPC by simply using the following example pascal cod

Re: [GENERAL] Postgres 9.0 Streaming Replication and Load Balancing?

2012-05-16 Thread Paulo Correia
Hello Sumit, At the given point there are no exceptions since the tests for using pgPool-II with the application using a master and a slave resulted in all connections being done on the master and none on the slave. As the application as it's own connection pool, eventually all connections w

Re: [GENERAL] FATAL: lock file "postmaster.pid" already exists

2012-05-16 Thread deepak
Hi! We could reproduce the start-up problem on Windows 2003. After a reboot, postmaster, in its start-up sequence cleans up old temporary files, and this step used to take several minutes (a little over 4 minutes), delaying the writing of line 6 onwards into the PID file. This delay caused pg_ctl

Re: [GENERAL] Libpq question

2012-05-16 Thread Chris Angelico
On Thu, May 17, 2012 at 1:21 AM, John Townsend wrote: > *** So...the question: Is there a good reason why you might want to NOT use > libpq.dll, and just directly access the server through direct function > calls? *** I don't know what you mean by function calls, but the Pike Postgres module dire

Re: [GENERAL] Libpq question

2012-05-16 Thread Merlin Moncure
On Wed, May 16, 2012 at 10:21 AM, John Townsend wrote: > It appears that some developers (Davart) are by-passing the standard client > library, “libpq.dll”, and directly accessing the server using Delphi or FPC. > I am not sure of the advantage here. All libpq.dll functions can be called > from De

Re: [GENERAL] Encryption - searching and sorting

2012-05-16 Thread Matthias
2012/5/14 Bruno Wolff III : > On Thu, May 03, 2012 at 15:42:00 +0200, >  David Welton wrote: >> >> >> Thoughts? Something I found interesting while researching exactly the same problem: http://web.mit.edu/ralucap/www/CryptDB-sosp11.pdf I haven't used any of it because the most interesting index

Re: [GENERAL] Encryption - searching and sorting

2012-05-16 Thread Merlin Moncure
On Thu, May 3, 2012 at 8:42 AM, David Welton wrote: > Hi, > > We have a situation where HIPAA data that needs to be encrypted. > Since we have lots of users, and a number of users who access the data > of different people, we cannot simply encrypt the disk and call it > good - it's not fine-graine

[GENERAL] Pre-built binary packages of PostgreSQL 9.2 Beta

2012-05-16 Thread Richard Broersma
I've seen the following statement made several places. "Pre-built binary packages of PostgreSQL 9.2 Beta are available from the project's downloads page for Windows, Mac OS X, Linux, FreeBSD and Solaris." But I looking in the following links does not produce any results: http://www.postgresql.or

Re: [GENERAL] Pre-built binary packages of PostgreSQL 9.2 Beta

2012-05-16 Thread Guillaume Lelarge
On Wed, 2012-05-16 at 10:28 -0700, Richard Broersma wrote: > I've seen the following statement made several places. > > "Pre-built binary packages of PostgreSQL 9.2 Beta are available from > the project's downloads page for Windows, Mac OS X, Linux, FreeBSD and > Solaris." > > But I looking in th

Re: [GENERAL] Pre-built binary packages of PostgreSQL 9.2 Beta

2012-05-16 Thread Richard Broersma
Okay, should the 9.2 beta announcement and press releases be amended to show this link rather than the ones posted? On Wed, May 16, 2012 at 10:40 AM, Guillaume Lelarge wrote: > On Wed, 2012-05-16 at 10:28 -0700, Richard Broersma wrote: >> I've seen the following statement made several places. >>

Re: [GENERAL] Pre-built binary packages of PostgreSQL 9.2 Beta

2012-05-16 Thread Guillaume Lelarge
On Wed, 2012-05-16 at 10:41 -0700, Richard Broersma wrote: > Okay, should the 9.2 beta announcement and press releases be amended > to show this link rather than the ones posted? > The only one available in the announcement is http://www.postgresql.org/download/ which contains the following parag

Re: [GENERAL] archive_command and streaming replication

2012-05-16 Thread Scott Briggs
Thanks Laurenz for the response. So if you do need to use wal files to catch up a slave, what would that process be? If you caught up with wal files, how would streaming replication know what positon to start at? And how would you tell streaming replication the new position after catching up with

Re: [GENERAL] Cannot find installers for 9.2 Beta

2012-05-16 Thread Basil Bourque
FYI… Link for documentation: http://www.postgresql.org/docs/9.2/static/index.html Thanks for the links in the other messages of this thread. Worked for me. —Basil Bourque -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.post

Re: [GENERAL] COPY from CSV, passing in default value?

2012-05-16 Thread Ben Madin
Does creating a table with a default not work? CREATE TABLE salaries ( Town varchar(30), County varchar(30) NOT NULL DEFAULT 'Australia', Supervisor varchar(30), StartDate date, Salary int, Benefits int ); You might also want an auto-incrementing primary key, especially if you a

Re: [GENERAL] COPY from CSV, passing in default value?

2012-05-16 Thread adebarros
Hi, Ben, Thanks for the suggestion. I do realize I could create the default value for the column; however, I probably should have specified that in this scenario I would want to supply several different values for the county (or any other missing field) during import. i.e., if I first imported a C

Re: [GENERAL] COPY from CSV, passing in default value?

2012-05-16 Thread Armand Turpel
A more elegant way is to include the create table and copy into a function and pass the default values to this function. Am 17/05/2012 03:35, schrieb adebarros: Hi, Ben, Thanks for the suggestion. I do realize I could create the default value for the column; however, I probably should have spe