Re: [GENERAL] How to make a non-removable row in a table?

2011-12-18 Thread Капралов Александр
I found a simple solution, but i don't know how to add raises an exception here. create rule protect_profile_id0_update as  on update to web.profile where old.id = 0  do instead nothing; create rule protect_profile_id0_delete as  on delete to web.profile where old.id = 0  do instead nothing; 2011

Re: [GENERAL] ignore duplicate key while using COPY?

2011-12-18 Thread David Johnston
Copy to a staging table without the constraint and then write a query to consolidate/remove the duplicate data and insert the clean data into the final table. It doesn't just give a warning because not importing a record from the source data should be a fatal error since it means you have a des

Re: [GENERAL] How to make a non-removable row in a table?

2011-12-18 Thread Thomas Markus
Hi, create a delete trigger that raises an exception Thomas Am 19.12.2011 07:43, schrieb Капралов Александр: Hi all. How to make a non-removable row in a table? In my case, I should not accidentally delete a row with id = 0. CREATE TABLE profile ( id integer NOT NULL, name char

[GENERAL] ignore duplicate key while using COPY?

2011-12-18 Thread Yan Chunlu
I am using COPY public.table_name FROM STDIN to import data. it is very efficient, but if there's any duplicate key exists, the whole procedure has been stopped. is there anyway to around this? why does not postgresql just give a warning and continue the copy? -- Sent via pgsql-general mailin

[GENERAL] How to make a non-removable row in a table?

2011-12-18 Thread Капралов Александр
Hi all. How to make a non-removable row in a table? In my case, I should not accidentally delete a row with id = 0. CREATE TABLE profile ( id integer NOT NULL, name character varying(265) NOT NULL ); CREATE SEQUENCE profile_id_seq START WITH 1 INCREMENT BY 1 NO MAXVALUE

Re: [GENERAL] pg_dump and pg_restore make data dir doubled size?

2011-12-18 Thread Yan Chunlu
never mind. just found I changed the wal_keep_segments to 5000, it's the size of pg_xlog dir who used a lot of space. On Sun, Dec 18, 2011 at 10:18 PM, Yan Chunlu wrote: > I just tried several times to make sure I didn't do anything wrong. > > I use > pg_dump -U postgres  -E UTF8  -F c -b -v -a

Re: [GENERAL] indexes and tables

2011-12-18 Thread amit sehas
Yes i was trying to determine how to make a View work in this situation. From reading the details on PostgreSQL Views are not persistent, ie they are just a SQL query short hand rather than actually creating any physical entity backing it (i would imagine that creating such a physical backing woul

Re: [GENERAL] Logical Aggregate Functions (eg ANY())

2011-12-18 Thread Merlin Moncure
On Sat, Dec 17, 2011 at 6:06 PM, Robert James wrote: > On 12/15/11, Marti Raudsepp wrote: >> On Thu, Dec 15, 2011 at 18:10, Robert James wrote: >>> How do I do the equivalent of an ANY() or ALL() in PG Aggregate SQL? >> >> Note that in many cases, writing an EXISTS(SELECT ...) or NOT >> EXISTS(.

Re: [GENERAL] recovery_target_timeline and multiple slave behavior when master fails

2011-12-18 Thread Fujii Masao
On Fri, Dec 16, 2011 at 3:59 AM, Rick Pufky wrote: > Any thoughts on the above snippets? Am I interpreting the documentation > correctly? Is there any further information needed to debug this? You need to share the archive directory between all three nodes to use that trick. To follow the timeli

Re: [GENERAL] indexes and tables

2011-12-18 Thread David Johnston
I've shown you how to make a proper VIEW that will accomplish what you want (i.e., 9 "UNION ALL" between 10 tables). Yes, the VIEW is simply a re-write RULE but the indexes on the corresponding tables are still very much real and "should" be used to when you make use of the VIEW over one of the t

Re: [GENERAL] indexes and tables

2011-12-18 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of amit sehas Sent: Thursday, December 15, 2011 9:22 PM To: pgsql-general@postgresql.org Subject: [GENERAL] indexes and tables HI, we have a schema related question. We have 1

Re: [GENERAL] New User: PostgreSQL Setup - "The Program 'postgress' is needed by initdb but was not found in the same directory..."

2011-12-18 Thread Steve Atkins
On Dec 15, 2011, at 10:12 PM, Patrick Kevin McCaffrey wrote: > Hello, > > I'm new to PostgreSQL, but am trying to set up a server on my machine. The > PostgreSQL server is to run inside of a LXC container - I'm not sure if this > is contributing to my problem or not, but it's worth mentioning

[GENERAL] New User: PostgreSQL Setup - "The Program 'postgress' is needed by initdb but was not found in the same directory..."

2011-12-18 Thread Patrick Kevin McCaffrey
Hello, I'm new to PostgreSQL, but am trying to set up a server on my machine. The PostgreSQL server is to run inside of a LXC container - I'm not sure if this is contributing to my problem or not, but it's worth mentioning. The main OS (host) of my machine is Ubuntu 11.10 (mostly, some packa

[GENERAL] indexes and tables

2011-12-18 Thread amit sehas
HI, we have a schema related question. We have 10 types of resource records. Each one of these resource records has 3 fields (attributes) (lets say f1, f2, f3)...these fields have similar meaning to the corresponding 3 fields in each resource record although they be named slightly differently in

[GENERAL] recovery_target_timeline and multiple slave behavior when master fails

2011-12-18 Thread Rick Pufky
I'm attempting to make use of the ability defined by the statement at the end of the first paragraph in this section of the documentation ( http://www.postgresql.org/docs/9.1/static/warm-standby.html#STANDBY-SERVER-SETUP). Specifically, "If you plan to have multiple standby servers for high availab

[GENERAL] pg_dump and pg_restore make data dir doubled size?

2011-12-18 Thread Yan Chunlu
I just tried several times to make sure I didn't do anything wrong. I use pg_dump -U postgres -E UTF8 -F c -b -v -a dbcontent -f data.backup then pg_restore -a -d dbcontent data.backup to restore a db, and the data dir's size on the source machine is 56GB, after I restored data on the target