Re: [SQL] Unexpected SQL error for UPDATE

2006-07-12 Thread Jaime Casanova
On 7/12/06, aurora <[EMAIL PROTECTED]> wrote: Yes that helped! reindex index users_email_address_text_key; what version of postgres is this? there have been some bug fixes that involved indexes on text columns. wich locale are you using? -- regards, Jaime Casanova "Programming today is a

Re: [SQL] Logging in Stored Procedure

2006-07-12 Thread Gregory S. Williamson
Well, perhaps the NOTICE functionality, e.g. RAISE NOTICE ''report id of % for date %'', rpt_rec.report_id, rpt_rec.report_s_date; This will show on the terminal if running from a console, and also writes to the log, IIRC. See the documentation for your version for details. HTH, Greg Williams

[SQL] Logging in Stored Procedure

2006-07-12 Thread Aaron Bono
OK, maybe a stupid simple question but, how do you add logging to a stored procedure?  My procedure is running but the results I get are not complete and I need to see better what is going wrong.  The tool I use has a debugger but the debugger is barfing at a particular line that, when run without

Re: [SQL] Can function results be used in WHERE?

2006-07-12 Thread Aaron Bono
On 7/11/06, Bryce Nesbitt <[EMAIL PROTECTED]> wrote: Tom Lane wrote:> But as far as the underlying misconception goes, you seem to think that> "4" in the WHERE clause might somehow be taken as referring to the> fourth SELECT result column (why you don't think that the "1" would > likewise refer to

Re: [SQL] SQL (Venn diagram type of logic)

2006-07-12 Thread Aaron Bono
On 7/11/06, Vinnie Ma <[EMAIL PROTECTED]> wrote: Hello Aaron,Thank you for the help.  My apologies for the directemail but i couldn't figure out how to reply to thethread on the postresql site. Just doing a reply to all should send it to the mailing list but the from address must match the email ad

Re: [SQL] Avoiding RI failure with INSERT ... SELECT FROM

2006-07-12 Thread Aaron Bono
On 7/12/06, Mark Stosberg <[EMAIL PROTECTED]> wrote: Hello! I got an unexpected SQL failure last night, and want to see howto prevent it in the future. This is with 8.1.3.I have a couple of insert statements that run in a transaction block,initializing rows that will be used the next day: INSERT in

Re: [SQL] How to find entries missing in 2nd table?

2006-07-12 Thread Scott Marlowe
On Wed, 2006-07-12 at 03:06, Exner, Peter wrote: > Hi, > > what about > > SELECT controller_id FROM control > WHERE controller_id NOT IN > (SELECT DISTINCT controller_id FROM datapack); That one works too, but it's generally not as fast as the left join / is null query on large tables. Give th

Re: [SQL] Unexpected SQL error for UPDATE

2006-07-12 Thread aurora
Yes that helped!  reindex index users_email_address_text_key;  UPDATE users set email_address_text=email_address;It kind of works now. Or at least it does not result in error. The UPDATE query is running for more than an hour and still hasn't return. This is inline  with what we have seen before th

[SQL] Avoiding RI failure with INSERT ... SELECT FROM

2006-07-12 Thread Mark Stosberg
Hello! I got an unexpected SQL failure last night, and want to see how to prevent it in the future. This is with 8.1.3. I have a couple of insert statements that run in a transaction block, initializing rows that will be used the next day: INSERT into item_hit_log SELECT item_id, CURRENT_DAT

Re: [SQL] Unexpected SQL error for UPDATE

2006-07-12 Thread Jaime Casanova
mydb=# UPDATE users set email_address_text=email_address; ERROR: invalid page header in block 6776 of relation "users_email_address_text_key" users_email_address_text_key sounds a lot like an index... is it an index? if so, what happenned if you REINDEX the table or even DROP and CREATE the in

Re: [SQL] Unexpected SQL error for UPDATE

2006-07-12 Thread Michael Glaesemann
On Jul 11, 2006, at 20:47 , aurora wrote: There is no simple SQL to alter the type. So I use a series of SQLs to create a new column, copy the data over and then replace the old column with the new. What version of PostgreSQL are you running? In 8.0 and later you can use ALTER TABLE ALTE

Re: [SQL] How to find entries missing in 2nd table?

2006-07-12 Thread Exner, Peter
Hi, what about SELECT controller_id FROM control WHERE controller_id NOT IN (SELECT DISTINCT controller_id FROM datapack); ? Regards Peter > -Ursprüngliche Nachricht- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Im Auftrag von > Richard Broersma Jr > Gesendet: Dienstag, 11