Re: [GENERAL] Old/New

2010-01-25 Thread Bob Pawley
To: Bob Pawley rjpaw...@shaw.ca Cc: Tom Lane t...@sss.pgh.pa.us; Postgresql pgsql-general@postgresql.org Sent: Saturday, January 23, 2010 10:06 AM Subject: Re: [GENERAL] Old/New On Saturday 23 January 2010 7:51:28 am Bob Pawley wrote: I havn't been able to find documentation on how to use \d

Re: [GENERAL] Old/New

2010-01-25 Thread Adrian Klaver
On 01/25/2010 10:24 AM, Bob Pawley wrote: The suggestions received have worked well for one update in the row. However, if I make any other update on the same row the trigger fires and more inserts are generated. However. I have found that the 8.5 alpha version has this addition -

Re: [GENERAL] Old/New

2010-01-23 Thread Bob Pawley
wasn't aware. Bob - Original Message - From: Adrian Klaver adrian.kla...@gmail.com To: Bob Pawley rjpaw...@shaw.ca Cc: Tom Lane t...@sss.pgh.pa.us; Postgresql pgsql-general@postgresql.org Sent: Friday, January 22, 2010 3:37 PM Subject: Re: [GENERAL] Old/New On Friday 22 January 2010

Re: [GENERAL] Old/New

2010-01-23 Thread Raymond O'Donnell
On 23/01/2010 15:51, Bob Pawley wrote: I havn't been able to find documentation on how to use \d. When I open Hi Bob, In brief: \dt lists all the tables in the current schema \d tablename gives the structure of the named table .. and loads of others. The docs are here:

Re: [GENERAL] Old/New

2010-01-23 Thread Adrian Klaver
On Saturday 23 January 2010 7:51:28 am Bob Pawley wrote: I havn't been able to find documentation on how to use \d. When I open the psql interface (through either port ) it asks for a password but doesn't allow any entry of a password. That would depend on the settings in pg_hba.conf, whether

Re: [GENERAL] Old/New

2010-01-22 Thread Bob Pawley
: Postgresql pgsql-general@postgresql.org Sent: Thursday, January 21, 2010 3:16 PM Subject: Re: [GENERAL] Old/New Bob Pawley rjpaw...@shaw.ca writes: I am getting a strange result when using the following - Select fluid_id into fluidid from p_id.processes where new.pump1 = 'True' and old.pump1

Re: [GENERAL] Old/New

2010-01-22 Thread Tom Lane
Bob Pawley rjpaw...@shaw.ca writes: Following is the format with which I have had great success using New in After Insert triggers. Insert into p_id.devices (p_id_id, process_id, fluid_id, status, process_graphics_id, device_description) select (p_id.processes.p_id_id),

Re: [GENERAL] Old/New

2010-01-22 Thread Bob Pawley
, January 22, 2010 9:56 AM Subject: Re: [GENERAL] Old/New Bob Pawley rjpaw...@shaw.ca writes: Following is the format with which I have had great success using New in After Insert triggers. Insert into p_id.devices (p_id_id, process_id, fluid_id, status, process_graphics_id, device_description

Re: [GENERAL] Old/New

2010-01-22 Thread Tom Lane
Bob Pawley rjpaw...@shaw.ca writes: I haven't found any documentation on how the underlying structure of PostgreSQL actually operates. So I have had to extrapolate. I think what you are saying is that on an update of a field the whole row which includes that field is affected to the extent

Re: [GENERAL] Old/New

2010-01-22 Thread Adrian Klaver
On 01/22/2010 11:20 AM, Bob Pawley wrote: I haven't found any documentation on how the underlying structure of PostgreSQL actually operates. So I have had to extrapolate. I think what you are saying is that on an update of a field the whole row which includes that field is affected to the

Re: [GENERAL] Old/New

2010-01-22 Thread Bob Pawley
versions of the same row. Bob - Original Message - From: Adrian Klaver adrian.kla...@gmail.com To: Bob Pawley rjpaw...@shaw.ca Cc: Tom Lane t...@sss.pgh.pa.us; Postgresql pgsql-general@postgresql.org Sent: Friday, January 22, 2010 12:34 PM Subject: Re: [GENERAL] Old/New On 01/22/2010

Re: [GENERAL] Old/New

2010-01-22 Thread Adrian Klaver
On 01/22/2010 01:05 PM, Bob Pawley wrote: Begin If new.pump1 = 'True' then Insert into p_id.devices (p_id_id, process_id, fluid_id, status, process_graphics_id, device_description) values (new.p_id_id, new.process_id, new.fluid_id, 'Pump #1', '11', 'Pump'); End if; If new.pump2 = 'True'

Re: [GENERAL] Old/New

2010-01-22 Thread Bob Pawley
...@shaw.ca Cc: Tom Lane t...@sss.pgh.pa.us; Postgresql pgsql-general@postgresql.org Sent: Friday, January 22, 2010 1:11 PM Subject: Re: [GENERAL] Old/New On 01/22/2010 01:05 PM, Bob Pawley wrote: Begin If new.pump1 = 'True' then Insert into p_id.devices (p_id_id, process_id, fluid_id, status

Re: [GENERAL] Old/New

2010-01-22 Thread Adrian Klaver
On 01/22/2010 01:16 PM, Bob Pawley wrote: I have a single row that is being duplicated on insert. Update statement - update p_id.processes set pump1 = 'True' where p_id.processes.fluid_id = '3501' ; The proper field is updated. Bob This is insufficient detail. What is the row? What are

Re: [GENERAL] Old/New

2010-01-22 Thread Bob Pawley
adrian.kla...@gmail.com To: Bob Pawley rjpaw...@shaw.ca Cc: Tom Lane t...@sss.pgh.pa.us; Postgresql pgsql-general@postgresql.org Sent: Friday, January 22, 2010 1:24 PM Subject: Re: [GENERAL] Old/New On 01/22/2010 01:16 PM, Bob Pawley wrote: I have a single row that is being duplicated on insert

Re: [GENERAL] Old/New

2010-01-22 Thread Tom Lane
Bob Pawley rjpaw...@shaw.ca writes: Instead I get two identical rows inserted containing the fluid_id = '3501' and 'Pump #1'. Seems like the only way that's possible with the INSERT .. VALUES formulation is if the trigger function gets executed twice. Maybe you accidentally created two

Re: [GENERAL] Old/New

2010-01-22 Thread Adrian Klaver
On Friday 22 January 2010 2:05:02 pm Tom Lane wrote: Bob Pawley rjpaw...@shaw.ca writes: Instead I get two identical rows inserted containing the fluid_id = '3501' and 'Pump #1'. Seems like the only way that's possible with the INSERT .. VALUES formulation is if the trigger function gets

Re: [GENERAL] Old/New

2010-01-22 Thread Bob Pawley
Lane t...@sss.pgh.pa.us Cc: Bob Pawley rjpaw...@shaw.ca; Postgresql pgsql-general@postgresql.org Sent: Friday, January 22, 2010 3:01 PM Subject: Re: [GENERAL] Old/New On Friday 22 January 2010 2:05:02 pm Tom Lane wrote: Bob Pawley rjpaw...@shaw.ca writes: Instead I get two identical rows

Re: [GENERAL] Old/New

2010-01-22 Thread Adrian Klaver
On Friday 22 January 2010 3:05:54 pm Bob Pawley wrote: This is the whole trigger Begin If new.pump1 = 'True' then Insert into p_id.devices (p_id_id, process_id, fluid_id, status, process_graphics_id, device_description) values (new.p_id_id, new.process_id, new.fluid_id, 'Pump

Re: [GENERAL] Old/New

2010-01-22 Thread Bob Pawley
, January 22, 2010 3:19 PM Subject: Re: [GENERAL] Old/New On Friday 22 January 2010 3:05:54 pm Bob Pawley wrote: This is the whole trigger Begin If new.pump1 = 'True' then Insert into p_id.devices (p_id_id, process_id, fluid_id, status, process_graphics_id, device_description) values

Re: [GENERAL] Old/New

2010-01-22 Thread Adrian Klaver
On Friday 22 January 2010 3:25:34 pm Bob Pawley wrote: No The table p_id.processes is the start of the fluid_id ident and that column is serial. Bob Per Tom's suggestion can we see \d for p_id.processes and for good measure p_id.devices ? -- Adrian Klaver adrian.kla...@gmail.com --

[GENERAL] Old/New

2010-01-21 Thread Bob Pawley
Hi I am getting a strange result when using the following - Select fluid_id into fluidid from p_id.processes where new.pump1 = 'True' and old.pump1 = 'False' or old.pump1 is null; The fluid_id return is fine when there is a single row. However with two rows, and updating only one of the

Re: [GENERAL] Old/New

2010-01-21 Thread Tom Lane
Bob Pawley rjpaw...@shaw.ca writes: I am getting a strange result when using the following - Select fluid_id into fluidid from p_id.processes where new.pump1 = 'True' and old.pump1 = 'False' or old.pump1 is null; The fluid_id return is fine when there is a single row. However with