[GENERAL] Duplicated tables of certain columns

2011-02-21 Thread Yan Cheng CHEOK
I try to duplicate a tables of certain columns by using CREATE TABLE backup_table AS SELECT * FROM unit_11 WHERE status = 1; I realize the above command will duplicate content of table unit_11 to backup_table. However, the index is not being carried over. Hence, I change my command to create t

Re: [GENERAL] Duplicated tables of certain columns

2011-02-21 Thread Vibhor Kumar
On Feb 21, 2011, at 1:39 PM, Yan Cheng CHEOK wrote: > INSERT INTO backup_table SELECT * FROM unit_11 WHERE status = 1; You can try something like, INSERT INTO backup_table select unit_id, 99, status, value from unit_11 where status=1; Thanks & Regards, Vibhor Kumar EnterpriseDB Corporation

Re: [GENERAL] Schema Archive cant find table

2011-02-21 Thread Vibhor Kumar
On Feb 18, 2011, at 9:10 PM, trex005 wrote: > I am trying to archive a schema, however there is a certain table that > gets skipped with pd_dump > > The table's name is 'servers'. I checked to see if it is a reserved > word, and it does not appear to be... > > Thinking I was missing something

Re: [GENERAL] Duplicated tables of certain columns

2011-02-21 Thread Yan Cheng CHEOK
Sorry. The table visualize display doesn't look right in the message, as I am using tab instead of space. I fix them. Table unit_11 = unit_id [PK]fk_lot_id status value 1 11 1 100 2 11 1 101 3 1

Re: [GENERAL] Worst case scenario of a compromised non super-user PostgreSQL user account

2011-02-21 Thread Craig Ringer
On 21/02/2011 3:44 PM, Allan Kamau wrote: Are there other problems we may expect. Can they run any OS programs or install any such tools, induce buffer overflows and so on.? So long as your webapp user and database owner is a regular user (non-superuser) without CREATE ROLE or CREATE DATABASE

Re: [GENERAL] ?????? [GENERAL] How to make the user-defined function or type beingaccessed in the global database server?

2011-02-21 Thread Craig Ringer
On 20/02/2011 2:13 PM, wrote: Thanks for your replying. But actually there are some difference database now, and I really want to define the user-defined function or type one time so that they can be accessed as system-defined function or type, how can I do? It sounds like you want som

Re: [GENERAL] ?????? [GENERAL] How to make the user-defined function or type beingaccessed in the global database server?

2011-02-21 Thread John R Pierce
On 02/19/11 10:13 PM, wrote: Thanks for your replying. But actually there are some difference database now, and I really want to define the user-defined function or type one time so that they can be accessed as system-defined function or type, how can I do? Thanks! an alternative m

[GENERAL] Drop CHECK Constraint

2011-02-21 Thread Yan Cheng CHEOK
I was wondering, is there any good way to drop a constraint? Currently, I am making assumption on the check constraint name. Although it works at current moment, I do not feel comfortable with it in long run. For example : ALTER TABLE backup_table ADD CHECK (fk_lot_id = 99); If I want to dr

Re: [GENERAL] Drop CHECK Constraint

2011-02-21 Thread Christian Ullrich
* Yan Cheng CHEOK wrote: I was wondering, is there any good way to drop a constraint? Currently, I am making assumption on the check constraint name. ALTER TABLE backup_table ADD CHECK (fk_lot_id = 99); If I want to drop the above CHECK constraint, I will do ALTER TABLE backup_table DROP C

Re: [GENERAL] multiple tables as a foreign key

2011-02-21 Thread Sim Zacks
On 02/21/2011 12:40 AM, matty jones wrote: I am not sure if this is possible but is there a way that I can have multiple columns from different tables be a foreign key to a single column in another table, or do I need to write a check function and if so how could I set up a relation? CREATE

Re: [GENERAL] password

2011-02-21 Thread Roedy Green
On Sun, 20 Feb 2011 21:44:22 -0800, pie...@hogranch.com (John R Pierce) wrote, quoted or indirectly quoted someone who said : >when you initially connect to postgres wtih psql or pgadmin-III, specify >the user as `postgres` and then once connected, It would not let me in even once. -- Roedy Gre

Re: [GENERAL] password

2011-02-21 Thread Roedy Green
On Mon, 21 Feb 2011 10:45:14 +0530, sachin.srivast...@enterprisedb.com (Sachin Srivastava) wrote, quoted or indirectly quoted someone who said : >Hello, > >Installation of postgresql requires you to enter a password for the user >'postgres'. > > i) If the user 'postgres' is not there, it will cre

Re: [GENERAL] Worst case scenario of a compromised non super-user PostgreSQL user account

2011-02-21 Thread Andrew Sullivan
On Mon, Feb 21, 2011 at 10:44:05AM +0300, Allan Kamau wrote: > A web application requires a dedicated PostgreSQL database in which to > create tables and other database objects and manipulate data within > this single database. Why does the web application need to create tables? I usually prefer

Re: [GENERAL] disable triggers using psql

2011-02-21 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I'm not sure how to address this. I'm not exactly sure where to place session_replication_role. It's very close to the top of the file: Is this a pg_dumpall? A \connect later on will reset the session_replicatio

[GENERAL] Continuous recovery stopping

2011-02-21 Thread Norberto Delle
Hi all I have a hot standby replication setup. But for no apparent reason, it stops the recovery. Here is a part of the log: 2011-02-21 11:07:03 BRT LOG: restored log file "00010009001B" from archive 2011-02-21 11:07:33 BRT LOG: restored log file "00010009001C" from a

[GENERAL] schema Cleanning

2011-02-21 Thread salah jubeh
Hello, I am trying to drop deprecated tables, views, procedures from an existing database, I am checking the pg_stat_user_tables view to check if the tables are accessed recently also to check live tuples. For deprecated views and procedures, I am wondering How can I do that, for example suppos

Re: [GENERAL] disable triggers using psql

2011-02-21 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I'm not sure how to address this. I'm not exactly sure where to place session_replication_role. It's very close to the top of the file: Is this a pg_dumpall? A \connect later on will reset the session_replicatio

Re: [GENERAL] disable triggers using psql

2011-02-21 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > The saga continues. I've reverted to a multi-step process to try and > figure this out. I create the initial database, then load it from the > command line psql as follows: > > pro-# \set session_replication_role replica; > pro-# \o db.ou

[GENERAL] Deadlock on the same select for update

2011-02-21 Thread Roman
Hi, I have problem with deadlocks and don't know why it happens. Below is the log (postgres 9.0, debian): [11882]DETAIL: Process 11882 waits for ShareLock on transaction 44324308; blocked by process 11884. Process 11884 waits for ShareLock on transaction 44324307; blocked by process 11882

Re: [GENERAL] Deadlock on the same select for update

2011-02-21 Thread Bill Moran
In response to Roman : > Hi, > I have problem with deadlocks and don't know why it happens. Below is > the log (postgres 9.0, debian): > > [11882]DETAIL: Process 11882 waits for ShareLock on transaction > 44324308; blocked by process 11884. > Process 11884 waits for ShareLock on transact

[GENERAL] why is there no TRIGGER ON SELECT ?

2011-02-21 Thread Melvin Davidson
Other than "It's currently not available", can anyone provide a logical explanation of why triggers cannot be implemented for SELECT statements, or rules for SELECT must be DO INSTEAD SELECT? PostgreSQL was derived from Ingres, and Ingres had a nice auditing feature that also handled SELECT. 

Re: [GENERAL] Schema version control

2011-02-21 Thread ChronicDB Community Team
> What about upgrades that can't be derived directly from an inspection > of the schema? Some examples: > > - Adding a NOT NULL constraint (without adding a DEFAULT). You often > want to precede this with filling in any existing NULL values, so the > new constraint doesn't fail. This is an imp

Re: [GENERAL] Schema version control

2011-02-21 Thread ChronicDB Community Team
On Fri, 2011-02-11 at 08:35 -0500, Daniel Popowich wrote: > think no software process can make anyone happy. It's a human > process: declare someone the owner of the database schema, let them > own the long term development of the schema, and if anyone needs a > change, they have to communicat

[GENERAL] string_agg hanging?

2011-02-21 Thread Joel Reed
Hoping someone will be kind enough to share how to write a query that uses 9.0's string_agg with a subselect, something like... select m.id,m.subject,m.from_address,m.date_sent,m.size,string_agg((select address as to_address from recipient r inner join message_recipient mr on r.id=mr.recipien

[GENERAL] Notify rule

2011-02-21 Thread ivan_14_32
Hi! I trying to create rule for update notifing: CREATE OR REPLACE RULE "ttt_NotifyU" AS ON UPDATE TO "ttt" DO NOTIFY "ttt", '88'; this work. But this CREATE OR REPLACE RULE "ttt_NotifyU" AS ON UPDATE TO "ttt" DO NOTIFY "ttt", NEW."id"; don't (syntax error), NOTIFY "ttt", CAST(NEW."id"

Re: [GENERAL] string_agg hanging?

2011-02-21 Thread Pavel Stehule
Hello these queries are different. I checked a string_agg and it working with me. So I am expecting, so your query has a performance problem when aggregate function is used. please, recheck so indexes are used you can try "set enable_seqscan" to off, maybe set hashagg to off please, send a execu