The following bug has been logged online: Bug reference: 1790 Logged by: Dmitry Karasik Email address: [EMAIL PROTECTED] PostgreSQL version: 8.1-devel Operating system: freebsd 5.4 Description: coredump in postgres Details:
pgsql is 8.1-devel, cvsup-latest configured with: /configure --enable-debug --with-perl --with-libraries=/usr/local/lib --with-includes=/usr/local/include --with-docdir=/usr/local/share/doc/postgresql --with-openssl --enable-nls --prefix=/usr/local i386-portbld-freebsd5.4 'LDFLAGS= -rpath=/usr/lib:/usr/local/lib' 'CFLAGS=-O -pipe -O3 -funroll-loops' host_alias=i386-portbld-freebsd5.4 build_alias=i386-portbld-freebsd5.4 target_alias=i386-portbld-freebsd5.4 CC=cc postgres.conf has all entries commented out # gdb postgres --core=/usr/local/pgsql/data/postgres.core GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... Core was generated by `postgres'. Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/local/lib/libintl.so.6...done. Loaded symbols for /usr/local/lib/libintl.so.6 Reading symbols from /usr/lib/libssl.so.3...done. Loaded symbols for /usr/lib/libssl.so.3 Reading symbols from /lib/libcrypto.so.3...done. Loaded symbols for /lib/libcrypto.so.3 Reading symbols from /lib/libz.so.2...done. Loaded symbols for /lib/libz.so.2 Reading symbols from /usr/local/lib/libreadline.so.5...done. Loaded symbols for /usr/local/lib/libreadline.so.5 Reading symbols from /lib/libcrypt.so.2...done. Loaded symbols for /lib/libcrypt.so.2 Reading symbols from /lib/libm.so.2...done. Loaded symbols for /lib/libm.so.2 Reading symbols from /lib/libutil.so.4...done. Loaded symbols for /lib/libutil.so.4 Reading symbols from /lib/libc.so.5...done. Loaded symbols for /lib/libc.so.5 Reading symbols from /usr/local/lib/libiconv.so.3...done. Loaded symbols for /usr/local/lib/libiconv.so.3 Reading symbols from /lib/libncurses.so.5...done. Loaded symbols for /lib/libncurses.so.5 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 create_or_index_quals (root=0x848bcc0, rel=0x84bb2b8) at pg_list.h:81 81 pg_list.h: No such file or directory. in pg_list.h (gdb) bt #0 create_or_index_quals (root=0x848bcc0, rel=0x84bb2b8) at pg_list.h:81 #1 0x0817fff5 in set_plain_rel_pathlist (root=0x848bcc0, rel=0x84bb2b8, rte=0x84a2538) at allpaths.c:204 #2 0x08180a09 in make_one_rel (root=0x848bcc0) at allpaths.c:177 #3 0x0818ecf3 in query_planner (root=0x848bcc0, tlist=0x84af558, tuple_fraction=0, cheapest_path=0xbfbfd21c, sorted_path=0xbfbfd220) at planmain.c:166 #4 0x0818f387 in grouping_planner (root=0x848bcc0, tuple_fraction=0) at planner.c:849 #5 0x08190854 in subquery_planner (parse=0x83b0e58, tuple_fraction=0, subquery_pathkeys=0x0) at planner.c:376 #6 0x0819092c in planner (parse=0x83b0e58, isCursor=0 '\0', cursorOptions=0, boundParams=0x0) at planner.c:135 #7 0x081db7a3 in pg_plan_queries (querytrees=0x0, boundParams=0x0, needSnapshot=0 '\0') at postgres.c:726 #8 0x081dc6bd in exec_simple_query ( query_string=0x83af228 "SELECT i.guid AS instanceid, i.parent_id AS checkdef, \n CASE\n", ' ' <repeats 12 times>, "WHEN i.lastchecked IS NOT NULL THEN i.lastchecked + i.checkintvl\n", ' ' <repeats 12 times>, "ELSE now()\n END AS schedtime\n FROM"...) at postgres.c:959 #9 0x081ded42 in PostgresMain (argc=4, argv=0x8385528, username=0x8385508 "pgsql") at postgres.c:3165 #10 0x081a7f99 in ServerLoop () at postmaster.c:2860 #11 0x081a971a in PostmasterMain (argc=3, argv=0xbfbfe99c) at postmaster.c:940 #12 0x0816494d in main (argc=3, argv=0xbfbfe99c) at main.c:268 I added prints to backend/optimizer/path/orindxpath.c that say that newrinfos is 0x0, and bestpath is 0x 84b8aa0 after this line: newrinfos = make_restrictinfo_from_bitmapqual((Path *) bestpath, true); and then (gdb) p *(BitmapOrPath*)0x84b8aa0 $1 = {path = {type = T_BitmapOrPath, pathtype = T_BitmapOr, parent = 0x84b73a0, startup_cost = 3.0029999999999997, total_cost = 3.0029999999999997, pathkeys = 0x0}, bitmapquals = 0x84ba658, bitmapselectivity = 0.014999999999999999} digging further into make_restrictinfo_from_bitmapqual I found that this code emits NIL on bestpath: else if (IsA(bitmapqual, IndexPath)) { IndexPath *ipath = (IndexPath *) bitmapqual; result = list_copy(ipath->indexclauses); } and in my case ipath->indexclauses was NIL: (gdb) p ((BitmapOrPath*)0x84b8aa0)->bitmapquals->head->data.ptr_value $8 = (void *) 0x84a2960 (gdb) p *((IndexPath*)0x84a2960) $16 = {path = {type = T_IndexPath, pathtype = T_IndexScan, parent = 0x849f8d8, startup_cost = 0, total_cost = 11.465782608695651, pathkeys = 0x0}, indexinfo = 0x849fca0, indexclauses = 0x0, indexquals = 0x0, isjoininner = 0 '\0', indexscandir = ForwardScanDirection, indextotalcost = 1.0009999999999999, indexselectivity = 0.0050000000000000001, rows = 1} That seemed to me like a problem in the planner where I don't have competence, so I stopped here. The full query was: SELECT i.guid AS instanceid, i.parent_id AS checkdef, CASE WHEN i.lastchecked IS NOT NULL THEN i.lastchecked + i.checkintvl ELSE now() END AS schedtime FROM v_rt_active_checks_with_status i WHERE ((i.lastchecked + i.checkintvl) < now() OR i.lastchecked IS NULL OR i.alertlevel > 49 AND (i.lastchecked + i.recheckintvl) < now()) AND (i.alertlevel < 30 OR i.alertlevel > 31 OR i.alertlevel IS NULL); ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly