[BUGS] BUG #2506: hash index
The following bug has been logged online: Bug reference: 2506 Logged by: Wagner Cipriano Email address: [EMAIL PROTECTED] PostgreSQL version: 8.0 Operating system: Linus Suse 10 Description:hash index Details: Error: index "xxx" is not a hash index. Always this error happen with me. Can You help me ? Thanks! ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [BUGS] BUG #2503: Query results differ based on record count
Alvaro Herrera wrote: > Russell Francis wrote: > >> If a SELECT statement contains a table in it's FROM clause which has 0 >> records in it, the query will not return any results. If a record is added >> to the table even though it shouldn't modify the results of query, the query >> will return the expected result. >> >> The SQL statements below are a trimmed down test case which duplicates this >> issue. The identical SELECT statements return different results depending >> on the record count of the unrelated table_b. >> >> SELECT table_a.* FROM table_a, table_b WHERE table_a.ta_col_a > 0; > > table_b is certainly not unrelated, as it appears in the FROM clause. > So the query is correct to not show any result, per definition of > cartesian product. > Alvaro, Yes, you are correct. Sorry. Thanks, Russ signature.asc Description: OpenPGP digital signature
[BUGS] use-after-free in psql
There's a minor bug in the ON_ERROR_ROLLBACK code in psql. In HEAD, at line 878 the storage pointed to by "results" is released by a PQclear(), but is referenced by the PQcmdStatus() calls on lines 898, 899, and 900. I'm busy at the moment -- if someone wants to fix this (backport to 8.1 please!), have at it. Otherwise I'll fix it this weekend. -Neil ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [BUGS] BUG #2506: hash index
"Wagner Cipriano" <[EMAIL PROTECTED]> writes: > Error: index "xxx" is not a hash index. > Always this error happen with me. You haven't provided enough information to let anyone help you ... but if you mean that you've got a corrupt index, REINDEXing it should fix that. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [BUGS] use-after-free in psql
> There's a minor bug in the ON_ERROR_ROLLBACK code in psql. In > HEAD, at line 878 the storage pointed to by "results" is > released by a PQclear(), but is referenced by the > PQcmdStatus() calls on lines 898, 899, and 900. > > I'm busy at the moment -- if someone wants to fix this > (backport to 8.1 please!), have at it. Attached is a quick patch for HEAD and 8.1, which should do the job. Thanks for finding this. -- Greg Sabino Mullane [EMAIL PROTECTED] PGP Key: 0x14964AC8 200606301039 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 Index: common.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/common.c,v retrieving revision 1.119 diff -u -u -r1.119 common.c --- common.c 14 Jun 2006 16:49:02 - 1.119 +++ common.c 30 Jun 2006 13:33:31 - @@ -875,8 +875,6 @@ if (OK) OK = PrintQueryResults(results); - PQclear(results); - /* If we made a temporary savepoint, possibly release/rollback */ if (on_error_rollback_savepoint) { @@ -884,23 +882,35 @@ /* We always rollback on an error */ if (transaction_status == PQTRANS_INERROR) + { + PQclear(results); results = PQexec(pset.db, "ROLLBACK TO pg_psql_temporary_savepoint"); + } /* If they are no longer in a transaction, then do nothing */ else if (transaction_status != PQTRANS_INTRANS) + { + PQclear(results); results = NULL; + } else { /* - * Do nothing if they are messing with savepoints themselves: If + * Do nothing if they are messing with savepoints themselves: if * the user did RELEASE or ROLLBACK, our savepoint is gone. If * they issued a SAVEPOINT, releasing ours would remove theirs. */ if (strcmp(PQcmdStatus(results), "SAVEPOINT") == 0 || strcmp(PQcmdStatus(results), "RELEASE") == 0 || strcmp(PQcmdStatus(results), "ROLLBACK") == 0) + { +PQclear(results); results = NULL; + } else + { +PQclear(results); results = PQexec(pset.db, "RELEASE pg_psql_temporary_savepoint"); + } } if (PQresultStatus(results) != PGRES_COMMAND_OK) { @@ -909,8 +919,8 @@ ResetCancelConn(); return false; } - PQclear(results); } + PQclear(results); /* Possible microtiming output */ if (OK && pset.timing) Index: common.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/common.c,v retrieving revision 1.110.2.1 diff -u -u -r1.110.2.1 common.c --- common.c 22 Nov 2005 18:23:27 - 1.110.2.1 +++ common.c 30 Jun 2006 13:42:29 - @@ -1067,8 +1067,6 @@ if (OK) OK = PrintQueryResults(results); - PQclear(results); - /* If we made a temporary savepoint, possibly release/rollback */ if (on_error_rollback_savepoint) { @@ -1076,23 +1074,35 @@ /* We always rollback on an error */ if (transaction_status == PQTRANS_INERROR) + { + PQclear(results); results = PQexec(pset.db, "ROLLBACK TO pg_psql_temporary_savepoint"); + } /* If they are no longer in a transaction, then do nothing */ else if (transaction_status != PQTRANS_INTRANS) + { + PQclear(results); results = NULL; + } else { /* - * Do nothing if they are messing with savepoints themselves: If + * Do nothing if they are messing with savepoints themselves: if * the user did RELEASE or ROLLBACK, our savepoint is gone. If * they issued a SAVEPOINT, releasing ours would remove theirs. */ if (strcmp(PQcmdStatus(results), "SAVEPOINT") == 0 || strcmp(PQcmdStatus(results), "RELEASE") == 0 || strcmp(PQcmdStatus(results), "ROLLBACK") == 0) + { +PQclear(results); results = NULL; + } else + { +PQclear(results); results = PQexec(pset.db, "RELEASE pg_psql_temporary_savepoint"); + } } if (PQresultStatus(results) != PGRES_COMMAND_OK) { @@ -1101,8 +,8 @@ ResetCancelConn(); return false; } - PQclear(results); } + PQclear(results); /* Possible microtiming output */ if (OK && pset.timing) signature.asc Description: This is a digitally signed message part
Re: [BUGS] use-after-free in psql
Neil Conway wrote: > There's a minor bug in the ON_ERROR_ROLLBACK code in psql. In HEAD, at > line 878 the storage pointed to by "results" is released by a PQclear(), > but is referenced by the PQcmdStatus() calls on lines 898, 899, and 900. I think this is the fix for HEAD. I'll apply after testing it a bit more. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ? common.c.fix Index: common.c === RCS file: /cvsroot/pgsql/src/bin/psql/common.c,v retrieving revision 1.119 diff -c -p -r1.119 common.c *** common.c14 Jun 2006 16:49:02 - 1.119 --- common.c30 Jun 2006 14:40:18 - *** SendQuery(const char *query) *** 875,893 if (OK) OK = PrintQueryResults(results); - PQclear(results); - /* If we made a temporary savepoint, possibly release/rollback */ if (on_error_rollback_savepoint) { transaction_status = PQtransactionStatus(pset.db); /* We always rollback on an error */ if (transaction_status == PQTRANS_INERROR) ! results = PQexec(pset.db, "ROLLBACK TO pg_psql_temporary_savepoint"); /* If they are no longer in a transaction, then do nothing */ else if (transaction_status != PQTRANS_INTRANS) ! results = NULL; else { /* --- 875,893 if (OK) OK = PrintQueryResults(results); /* If we made a temporary savepoint, possibly release/rollback */ if (on_error_rollback_savepoint) { + PGresult *svptres; + transaction_status = PQtransactionStatus(pset.db); /* We always rollback on an error */ if (transaction_status == PQTRANS_INERROR) ! svptres = PQexec(pset.db, "ROLLBACK TO pg_psql_temporary_savepoint"); /* If they are no longer in a transaction, then do nothing */ else if (transaction_status != PQTRANS_INTRANS) ! svptres = NULL; else { /* *** SendQuery(const char *query) *** 898,917 if (strcmp(PQcmdStatus(results), "SAVEPOINT") == 0 || strcmp(PQcmdStatus(results), "RELEASE") == 0 || strcmp(PQcmdStatus(results), "ROLLBACK") == 0) ! results = NULL; else ! results = PQexec(pset.db, "RELEASE pg_psql_temporary_savepoint"); } ! if (PQresultStatus(results) != PGRES_COMMAND_OK) { psql_error("%s", PQerrorMessage(pset.db)); PQclear(results); ResetCancelConn(); return false; } - PQclear(results); } /* Possible microtiming output */ if (OK && pset.timing) printf(_("Time: %.3f ms\n"), DIFF_MSEC(&after, &before)); --- 898,919 if (strcmp(PQcmdStatus(results), "SAVEPOINT") == 0 || strcmp(PQcmdStatus(results), "RELEASE") == 0 || strcmp(PQcmdStatus(results), "ROLLBACK") == 0) ! svptres = NULL; else ! svptres = PQexec(pset.db, "RELEASE pg_psql_temporary_savepoint"); } ! if (svptres && PQresultStatus(svptres) != PGRES_COMMAND_OK) { psql_error("%s", PQerrorMessage(pset.db)); PQclear(results); + PQclear(svptres); ResetCancelConn(); return false; } } + PQclear(results); + /* Possible microtiming output */ if (OK && pset.timing) printf(_("Time: %.3f ms\n"), DIFF_MSEC(&after, &before)); ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq