Re: [GENERAL] Is there any way to import a portion of a large database

2011-09-19 Thread John R Pierce
On 09/19/11 11:35 PM, AI Rumman wrote: I have a production Postgresql 9 database of 2 TB+. For development purpose, I have to import this database in development server where I have only 1 TB of disk space. No more space can be added at present. Is there any way so that I might import the whole

Re: [GENERAL] Is there any way to import a portion of a large database

2011-09-19 Thread Craig Ringer
On 09/20/2011 02:35 PM, AI Rumman wrote: I have a production Postgresql 9 database of 2 TB+. For development purpose, I have to import this database in development server where I have only 1 TB of disk space. No more space can be added at present. Is there any way so that I might import the who

[GENERAL] Is there any way to import a portion of a large database

2011-09-19 Thread AI Rumman
I have a production Postgresql 9 database of 2 TB+. For development purpose, I have to import this database in development server where I have only 1 TB of disk space. No more space can be added at present. Is there any way so that I might import the whole schema definition of the database with a p

Re: [GENERAL] Dynamic constraint names in ALTER TABLE

2011-09-19 Thread patrick keshishian
On Mon, Sep 19, 2011 at 8:34 PM, Tom Lane wrote: > patrick keshishian writes: >> The question wasn't where does one find the name of the constraint. My >> example demonstrated that I knew how to get that value. The question, >> however, is how do you get that in an ALTER TABLE statement? > > You'

Re: [GENERAL] Dynamic constraint names in ALTER TABLE

2011-09-19 Thread patrick keshishian
2011/9/19 Ondrej Ivanič : > Hi, > > On 20 September 2011 13:09, patrick keshishian wrote: >> e.g., ALTER TABLE sales DROP CONSTRAINT (SELECT conname FROM >> pg_constraint JOIN pg_class ON (conrelid=pg_class.oid) WHERE >> pg_class.relname='sales' AND conkey[1] = 1 AND contype='f') ; > > You have to

Re: [GENERAL] Dynamic constraint names in ALTER TABLE

2011-09-19 Thread Tom Lane
patrick keshishian writes: > The question wasn't where does one find the name of the constraint. My > example demonstrated that I knew how to get that value. The question, > however, is how do you get that in an ALTER TABLE statement? You'd need to construct the ALTER statement as a string value

Re: [GENERAL] Dynamic constraint names in ALTER TABLE

2011-09-19 Thread Ondrej Ivanič
Hi, On 20 September 2011 13:09, patrick keshishian wrote: > e.g., ALTER TABLE sales DROP CONSTRAINT (SELECT conname FROM > pg_constraint JOIN pg_class ON (conrelid=pg_class.oid) WHERE > pg_class.relname='sales' AND conkey[1] = 1 AND contype='f') ; You have to build query in different way: psql

Re: [GENERAL] Dynamic constraint names in ALTER TABLE

2011-09-19 Thread patrick keshishian
On Mon, Sep 19, 2011 at 6:08 PM, Adrian Klaver wrote: > On Monday, September 19, 2011 5:10:45 pm patrick keshishian wrote: >> Hi, >> >> Is there any way the .sql scripts could make use of this query to get >> the foreign key name from pg_constraint table, regardless of PG >> version (7.4.x or 9.x)

Re: [GENERAL] Dynamic constraint names in ALTER TABLE

2011-09-19 Thread Adrian Klaver
On Monday, September 19, 2011 5:10:45 pm patrick keshishian wrote: > Hi, > > > > Is there any way the .sql scripts could make use of this query to get > the foreign key name from pg_constraint table, regardless of PG > version (7.4.x or 9.x)? Use the information schema? As example: http://www

[GENERAL] Dynamic constraint names in ALTER TABLE

2011-09-19 Thread patrick keshishian
Hi, Where I work, we have a large deployment of software using PostgreSQL database. We have been stuck on version 7.4.16 for a while now. I am about to switch us to a 9.0.x. One problem I'm running into, and I am hoping you can help me with, given the constraints I have to work with, is our conve

Re: [GENERAL] Getting TOAST errors

2011-09-19 Thread Tim Uckun
> > A self-contained test case (code and data) that triggers the error. > If it only does so probabilistically, once in every-so-many runs, > that's fine. I'll see what I can do. Give me a few days. Cheers. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes t

Re: [GENERAL] Getting TOAST errors

2011-09-19 Thread Tom Lane
Tim Uckun writes: >> Well, I'm not asking for perfect reproducibility --- a test case that >> fails even 1% of the time would be great. > What exactly do you need? A self-contained test case (code and data) that triggers the error. If it only does so probabilistically, once in every-so-many runs

Re: [GENERAL] Getting TOAST errors

2011-09-19 Thread Tim Uckun
> >> Not really. I have a nightly process which downloads data and sticks >> it into a text field. Afterwards another process reads that text data >> and processes it creating rows in another table. The problem occurs in >> the last step and at seemingly random intervals. For example one time >> it

[GENERAL] Pgadmin and foreign tables

2011-09-19 Thread pasman pasmański
Hi. In 9.1 is cool feature - foreign tables. But when create foreign table in pgadmin (file_fdw wrapper), strings in the OPTIONS section ignore setting standard_conforming_strings=on. I don't know if it is a bug in postgres or pgadmin. -- pasman -- Sent via pgsql-general mailing l

Re: [GENERAL] Getting TOAST errors

2011-09-19 Thread Tom Lane
Tim Uckun writes: >> Hard to tell. We've seen enough reports like that to make it seem like >> there may be some bug buried there, but no one has provided anything to >> do any debugging work with. Can you create a reproducible test case? > Not really. I have a nightly process which downloads dat

Re: [GENERAL] Am I best off keeping large chunks of text in a separate table?

2011-09-19 Thread Jerry Sievers
Mike Christensen writes: >> On Sat, Sep 17, 2011 at 6:46 PM, Mike Christensen wrote: >> >> What would be really cool is if postgresql took values for body that >> were over a few k and compressed them and stored them out of line in >> another table.  Luckily for you, that's EXACTLY what it alrea

Re: [GENERAL] Getting TOAST errors

2011-09-19 Thread Tim Uckun
> > Hard to tell.  We've seen enough reports like that to make it seem like > there may be some bug buried there, but no one has provided anything to > do any debugging work with.  Can you create a reproducible test case? Not really. I have a nightly process which downloads data and sticks it into

Re: [GENERAL] Column Privileges: NULL instead of permission denied

2011-09-19 Thread Stephen Frost
* Matthew Hawn (matth...@donaanacounty.org) wrote: > I have a table with privileged data that is restricted using column level > permissions. I would like to have single query that returns data from the > table. If the user has permission, it should return the data but return > NULL if the user

[GENERAL] Column Privileges: NULL instead of permission denied

2011-09-19 Thread Matthew Hawn
I have a table with privileged data that is restricted using column level permissions. I would like to have single query that returns data from the table. If the user has permission, it should return the data but return NULL if the user does not have permission. I do not want to create separat

Re: [GENERAL] General guidance if there is an in dadabase solution or should stay as excel vba solution.

2011-09-19 Thread Henry Drexler
excellent - thank you again. On Mon, Sep 19, 2011 at 11:05 AM, David Johnston wrote: > You can probably do this without plpgsql through liberal use of CTEs (WITH) > and sub-queries. > > Also look at arrayed types for "saving" matches and filtering out already > tested pairs. > > David J. > > > O

[GENERAL] Calculate Vacuum Metrics

2011-09-19 Thread Venkat Balaji
Hello Everyone, I am in the process of scheduling a VACUUM FULL for our production databases where in downtime is extremely critical. Can someone please help me calculate the amount of free space (or free pages) in the Table and Index (even after regular autovacuum or vacuum analyze is performed)

Re: [GENERAL] postgis and pgpool

2011-09-19 Thread Szymon Guz
On 19 September 2011 16:17, Tatsuo Ishii wrote: > > Hi, > > do you know about any problems with using pgpool and postgis together? > > I personaly don't know any case study of pgpool and posgis but I > guess: > > 1) You are using pgpool-II native replication mode > 2) Some of postgis functions ar

Re: [GENERAL] General guidance if there is an in dadabase solution or should stay as excel vba solution.

2011-09-19 Thread David Johnston
You can probably do this without plpgsql through liberal use of CTEs (WITH) and sub-queries. Also look at arrayed types for "saving" matches and filtering out already tested pairs. David J. On Sep 19, 2011, at 10:37, Henry Drexler wrote: > Thanks you that is the kind of suggestion I was look

Re: [GENERAL] Query performs badly with materialize node

2011-09-19 Thread Tom Lane
Ingmar Brouns writes: > What I find strange is that there is a conditionless index scan on > participates, retrieving all its rows, and then a nested loop over all those > rows and a materialize node. Yeah, that indexscan looks pretty odd to me too, but it's likely explained by the context that y

Re: [GENERAL] How to pass array from .pgc to sql function

2011-09-19 Thread Merlin Moncure
On Mon, Sep 19, 2011 at 8:20 AM, Siva Palanisamy wrote: > Hi All, > > > > I am using embedded Postgres ‘C’ file to make function calls to the sql. I > have a .pgc (a ‘C’ file with sql statements) and .sql file. > > > > I have a pointer array that looks like this: > > typedef struct { > >  

Re: [GENERAL] General guidance if there is an in dadabase solution or should stay as excel vba solution.

2011-09-19 Thread Henry Drexler
Thanks you that is the kind of suggestion I was looking for - I will look into plpgsql. Yes, there are several optimizations in it - though due to the actual data the first few characters cannot be tested. Some of the actual optimizations are only to reach out to the surrounding 100 rows and to s

Re: [GENERAL] Getting TOAST errors

2011-09-19 Thread Tom Lane
Tim Uckun writes: > I am occasionally getting this kind of error when attempting a SELECT > statement. > PGError: ERROR: missing chunk number 0 for toast value 27143 in > pg_toast_2619 > What does this mean? Is some sort of corruption creeping into the database? Hard to tell. We've seen enou

Re: [GENERAL] postgis and pgpool

2011-09-19 Thread Tatsuo Ishii
> Hi, > do you know about any problems with using pgpool and postgis together? I personaly don't know any case study of pgpool and posgis but I guess: 1) You are using pgpool-II native replication mode 2) Some of postgis functions are doing updates/inserts/deletes then you may have problem becau

Re: [GENERAL] General guidance if there is an in dadabase solution or should stay as excel vba solution.

2011-09-19 Thread David Johnston
Look at this module for the actual comparison algorithms (found in Appendix F) "fuzzystrmatch" Performance would be my only concern but you have that issue either way. With "plpgsql" you can do most things in the database you could do in VBA. Whether you want to bog the DB down with a proce

[GENERAL] General guidance if there is an in dadabase solution or should stay as excel vba solution.

2011-09-19 Thread Henry Drexler
I have no problem doing this in excel vba, though as the list grows larger obviously excel has row limits. What is being done: There is a column of data imported into the db - they are just text strings, there are about 80,000 rows of them. The goal is to do a single character elimination to fin

[GENERAL] Query performs badly with materialize node

2011-09-19 Thread Ingmar Brouns
Hi, I have a query for which PostgreSQL 9.0.3 and 9.1 rc1 both come up with what seems to be a very bad plan when materialize is enabled. The plan with materialize takes 5 seconds to execute, the plan without 7 ms. Part of the plan with materialization enabled #effectively loop over all rows in

[GENERAL] How to pass array from .pgc to sql function

2011-09-19 Thread Siva Palanisamy
Hi All, I am using embedded Postgres 'C' file to make function calls to the sql. I have a .pgc (a 'C' file with sql statements) and .sql file. I have a pointer array that looks like this: typedef struct { char* displayName; } DisplayName; DisplayName* displayName_list = calloc(5

Re: [GENERAL] Grouping by timestamp, how to return 0 when there's no record

2011-09-19 Thread Diego Augusto Molina
Hi, this may be a start: -- This will make our day better :) with base_query (tstmp) as ( select DATE_TRUNC('hour',timestamp) as tstmp FROM record WHERE record.timestamp BETWEEN ( CURRENT_TIMESTAMP + INTERVAL '-7 day') and (CURRENT_TIMESTAMP) -- this I don't under

Re: [GENERAL] Grouping by timestamp, how to return 0 when there's no record

2011-09-19 Thread Alban Hertroys
On 19 September 2011 12:01, Koen Van Impe wrote: > Hello, > > I'm trying to write a query that groups records by hour. > This works fine but when there are no records for a specific hour the > query does not return a result (this seems 'logic') and I'd like it to > return '0'. I suspect I should

Re: [GENERAL] Clean way to insert records if they don't exist, update if they do

2011-09-19 Thread Diego Augusto Molina
Hi, first of all, I still haven't tried PG further that 8.4 2011/9/18, Mike Christensen : > CREATE RULE Pages_Upsert AS ON INSERT TO Pages >WHERE EXISTS (SELECT 1 from Pages P where NEW.Url = P.Url) >DO INSTEAD > UPDATE Pages SET LastCrawled = NOW(), Html = NEW.Html WHERE Url = > NEW

[GENERAL] postgis and pgpool

2011-09-19 Thread Szymon Guz
Hi, do you know about any problems with using pgpool and postgis together? regards Szymon

[GENERAL] Getting TOAST errors

2011-09-19 Thread Tim Uckun
I am occasionally getting this kind of error when attempting a SELECT statement. PGError: ERROR: missing chunk number 0 for toast value 27143 in pg_toast_2619 What does this mean? Is some sort of corruption creeping into the database? Postgres 9.0 linux. -- Sent via pgsql-general mailing lis

Re: [GENERAL] duplicate sequence, it is possible?

2011-09-19 Thread Vincent de Phily
On Monday 19 September 2011 08:19:18 Alban Hertroys wrote: > On 19 Sep 2011, at 2:57, Anibal David Acosta wrote: > > Hi everyone. > > > > I have a table with a PK, this table has a lot of insert per second (100 > > ~ 150 insert /sec) Sometimes, a get a duplicate key error, but ID is > > generated

[GENERAL] Grouping by timestamp, how to return 0 when there's no record

2011-09-19 Thread Koen Van Impe
Hello, I'm trying to write a query that groups records by hour. This works fine but when there are no records for a specific hour the query does not return a result (this seems 'logic') and I'd like it to return '0'. I suspect I should play around with 'interval' or something but I can't get it to

Re: [GENERAL] Dblink upgrade from 8.4 to 9.1

2011-09-19 Thread Rueegg Alexander
Sorry, but I have to correct my first description of the failure. Indeed the "uuid-ossp" module was not migrated automatically. For some reasons when restoring the database I've chosen to clean before restore. And in this scenario the migration took place. Starting from a clean new db the backup

[GENERAL] Dblink upgrade from 8.4 to 9.1

2011-09-19 Thread Rueegg Alexander
Hi all! I am upgrading databases from 8.4 to 9.1 using backup/restore. Whilst the restore procedure migrate the module "uuid-ossp" automatically, the module "dblink" is not. Executing "create extension if not exists dblink from unpackaged" on the database fails too! When deleting all dblink fun