Betr: Re: [GENERAL] Question insert data
That's what I tought the problem was, but I created a table afterwards without inheritence. Could it have something to do with the max size of the schema or oid's? -- Oorspronkelijk bericht -- Date: Sat, 19 Mar 2005 14:55:50 -0800 (PST) From: Stephan Szabo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Question insert data On Sat, 19 Mar 2005 [EMAIL PROTECTED] wrote: Hi There, I've a problem with inserting data and I can't figure out what the problem is: what did I do: 1. I've a master table containing about 4 records. A count(*) provides me the exact number. 2. I've create a table based on from the master. I copied a fraction from the master into the new table using a where clause (insert into ... select * from ... where a = b . The number of records copied is about 2553. Define based on. Do you mean CREATE TABLE AS or perhaps that the new table inherits from the old one? If the latter, you will see the rows in the parent as well as the child if you do a select from the parent. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster _ 12move ADSL vanaf 18,95 euro! GRATIS modem, GEEN aansluitkosten en GEEN datalimiet! Ga nu naar http://adsl.12move.nl ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: Betr: Re: [GENERAL] Question insert data
On Sun, 20 Mar 2005 [EMAIL PROTECTED] wrote: That's what I tought the problem was, but I created a table afterwards without inheritence. Could it have something to do with the max size of the schema or oid's? I can't think of a reason it would, so can you send a self-contained full example? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Betr: Re: Betr: Re: [GENERAL] Question insert data
Hi Stephan, I figured out what happened: The master table contained duplicates, but the insert statement seems to be very smart by selecting just the unique ones. Peter -- Oorspronkelijk bericht -- Date: Sun, 20 Mar 2005 01:46:19 -0800 (PST) From: Stephan Szabo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: pgsql-general@postgresql.org Subject: Re: Betr: Re: [GENERAL] Question insert data On Sun, 20 Mar 2005 [EMAIL PROTECTED] wrote: That's what I tought the problem was, but I created a table afterwards without inheritence. Could it have something to do with the max size of the schema or oid's? I can't think of a reason it would, so can you send a self-contained full example? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster _ 12move ADSL vanaf 18,95 euro! GRATIS modem, GEEN aansluitkosten en GEEN datalimiet! Ga nu naar http://adsl.12move.nl ---(end of broadcast)--- TIP 8: explain analyze is your friend
Betr: Re: [GENERAL] Question insert data
insert into master_nl select * from master where substr(loc,1,2) = 'NL' -- Oorspronkelijk bericht -- Subject: Re: [GENERAL] Question insert data From: Ragnar HafstaĆ° [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: pgsql-general@postgresql.org Date: Sat, 19 Mar 2005 17:56:52 + On Sat, 2005-03-19 at 18:36 +0100, [EMAIL PROTECTED] wrote: 2. I've create a table based on from the master. I copied a fraction from the master into the new table using a where clause (insert into ... select * from ... where a = b . The number of records copied is about 2553. Issueing the same select statement on the master table gives me a list of 5106 which is twice the number of copied records. sounds like you inserted into the master table instead of the new table. can you show us the exact SQL you used? or even better, can you make this happen in a simple test case? gnari _ 12move ADSL vanaf 18,95 euro! GRATIS modem, GEEN aansluitkosten en GEEN datalimiet! Ga nu naar http://adsl.12move.nl ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Betr: Re: [GENERAL] Question insert data
Some more info select count(*) from master_bart where substr(locode_c5,1,2) = 'NL' gives me the result: 5106 delete from masterplts_nl; insert into masterplts_nl select * from master_bart where substr(locode_c5,1,2) = 'NL'; Query returned successfully: 2553 rows affected, 5127 ms execution time. -- Oorspronkelijk bericht -- Subject: Re: [GENERAL] Question insert data From: Ragnar HafstaĆ° [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: pgsql-general@postgresql.org Date: Sat, 19 Mar 2005 17:56:52 + On Sat, 2005-03-19 at 18:36 +0100, [EMAIL PROTECTED] wrote: 2. I've create a table based on from the master. I copied a fraction from the master into the new table using a where clause (insert into ... select * from ... where a = b . The number of records copied is about 2553. Issueing the same select statement on the master table gives me a list of 5106 which is twice the number of copied records. sounds like you inserted into the master table instead of the new table. can you show us the exact SQL you used? or even better, can you make this happen in a simple test case? gnari _ 12move ADSL vanaf 18,95 euro! GRATIS modem, GEEN aansluitkosten en GEEN datalimiet! Ga nu naar http://adsl.12move.nl ---(end of broadcast)--- TIP 8: explain analyze is your friend