Tip of current tree: Seg fault in query - Mailing list pgsql-hackers

From Kevin O'Gorman
Subject Tip of current tree: Seg fault in query
Date
Msg-id 3A0B4E49.A18794C3@pacbell.net
Whole thread Raw
Responses Re: Tip of current tree: Seg fault in query  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom asked me to bust it some more 8-)

I've attached the query and the gdb backtrace.  This is very
repeatable, so if there's more info needed, let me know.


--
Kevin O'Gorman  (805) 650-6274  mailto:kogorman@pacbell.net
Permanent e-mail forwarder:  mailto:Kevin.O'Gorman.64@Alum.Dartmouth.org
At school: mailto:kogorman@cs.ucsb.edu
Web: http://www.cs.ucsb.edu/~kogorman/index.html
Web: http://trixie.kosman.via.ayuda.com/~kevin/index.html

"There is a freedom lying beyond circumstance,
derived from the direct intuition that life can
be grounded upon its absorption in what is
changeless amid change"
   -- Alfred North WhiteheadScript started on Thu Nov  9 17:19:02 2000
[kevin@glynnis OLAP]$ cat bust.sql
-- bust.sql
/* Cause a backend crash */

\qecho Running $Id: bust.sql,v 1.1 2000/11/10 01:12:49 kevin Exp kevin $

/* first, execute this: */

delete from tmprolling
;

EXPLAIN
select
    a.product_level,
    a.customer_level,
    a.channel_level,
    199504,
    sum (a.dollarsales) / 4 As dollarsales
from
    actvars a, prodlevel, custlevel
where
        a.time_level in ('199501','199502','199503','199504')
    and prodlevel.code_level = a.product_level
    and custlevel.store_level = a.customer_level
    and prodlevel.Class_level = 'I7BEZZM9YJND'
    and custlevel.Retailer_level = 'TBVYYQ1ONYC8'
group by
    a.product_level,
    a.customer_level,
    a.channel_level
;

\! date

insert into tmprolling (
    product_level,
    customer_level,
    channel_level,
    time_level,
    dollarsales
)
select
    a.product_level,
    a.customer_level,
    a.channel_level,
    199504,
    sum (a.dollarsales) / 4 As dollarsales
from
    actvars a, prodlevel, custlevel
where
        a.time_level in ('199501','199502','199503','199504')
    and prodlevel.code_level = a.product_level
    and custlevel.store_level = a.customer_level
    and prodlevel.Class_level = 'I7BEZZM9YJND'
    and custlevel.Retailer_level = 'TBVYYQ1ONYC8'
group by
    a.product_level,
    a.customer_level,
    a.channel_level
;
[kevin@glynnis OLAP]$ psql
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

kevin=# \i bust.sql
Running $Id: bust.sql,v 1.1 2000/11/10 01:12:49 kevin Exp kevin $
DELETE 0
psql:bust.sql:30: NOTICE:  QUERY PLAN:

Group  (cost=1379.83..1379.84 rows=1 width=68)
  ->  Sort  (cost=1379.83..1379.83 rows=1 width=68)
        ->  Nested Loop  (cost=0.00..1379.82 rows=1 width=68)
              ->  Index Scan using ctl2 on custlevel  (cost=0.00..2.01 rows=1 width=12)
              ->  Materialize  (cost=1377.16..1377.16 rows=52 width=56)
                    ->  Nested Loop  (cost=0.00..1377.16 rows=52 width=56)
                          ->  Index Scan using plf2 on prodlevel  (cost=0.00..3.06 rows=2 width=12)
                          ->  Index Scan using custindex on actvars a  (cost=0.00..915.85 rows=17 width=44)

EXPLAIN
Thu Nov  9 17:19:58 PST 2000
psql:bust.sql:59: pqReadData() -- backend closed the channel unexpectedly.
    This probably means the backend terminated abnormally
    before or while processing the request.
psql:bust.sql:59: connection to server was lost
[kevin@glynnis OLAP]$
Script done on Thu Nov  9 17:20:11 2000
Script started on Thu Nov  9 17:19:32 2000
[root@glynnis bin]# gdb
GNU gdb 4.18
Copyright 1998 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-redhat-linux".
(gdb) file postgres
Reading symbols from postgres...done.
(gdb) attach 3996
Attaching to program: /PG/pgsql-7.1/bin/postgres, Pid 3996
Reading symbols from /usr/lib/libz.so.1...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /usr/lib/libreadline.so.3...done.
Reading symbols from /lib/libtermcap.so.2...done.
Reading symbols from /usr/lib/libncurses.so.4...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_files.so.2...done.
0x401a1df2 in __libc_recv () from /lib/libc.so.6
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
attnameAttNum (rd=0x10000, a=0x82172a0 "product_level") at parse_relation.c:967
967        for (i = 0; i < rd->rd_rel->relnatts; i++)
(gdb) bt
#0  attnameAttNum (rd=0x10000, a=0x82172a0 "product_level") at parse_relation.c:967
#1  0x809a818 in checkInsertTargets (pstate=0x8218350, cols=0x82172d0, attrnos=0xbffff058)
    at parse_target.c:374
#2  0x808944f in transformInsertStmt (pstate=0x8218350, stmt=0x8218310) at analyze.c:442
#3  0x808918d in transformStmt (pstate=0x8218350, parseTree=0x8218310) at analyze.c:248
#4  0x8088eb0 in parse_analyze (parseTree=0x8218310, parentParseState=0x0) at analyze.c:88
#5  0x80ef066 in pg_analyze_and_rewrite (parsetree=0x8218310) at postgres.c:442
#6  0x80ef30e in pg_exec_query_string (
    query_string=0x8216df8 "insert into tmprolling (\n\tproduct_level,
\n\tcustomer_level,\n\tchannel_level,\n\ttime_level,\n\tdollarsales\n)\nselect\n\ta.product_level,
\n\ta.customer_level,\n\ta.channel_level,\n\t199504,\n\tsum(a.dollarsales) / 4 "..., dest=Remote,  
    parse_context=0x81ba8b8) at postgres.c:749
#7  0x80f0273 in PostgresMain (argc=4, argv=0xbffff2ac, real_argc=1, real_argv=0xbffffbc4,
    username=0x81cce29 "kevin") at postgres.c:1823
#8  0x80dbfa3 in DoBackend (port=0x81ccbc0) at postmaster.c:2019
#9  0x80dbb5a in BackendStartup (port=0x81ccbc0) at postmaster.c:1788
#10 0x80dae8a in ServerLoop () at postmaster.c:1011
#11 0x80da8e4 in PostmasterMain (argc=1, argv=0xbffffbc4) at postmaster.c:686
#12 0x80bf286 in main (argc=1, argv=0xbffffbc4) at main.c:112
(gdb) q
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /PG/pgsql-7.1/bin/postgres, Pid 3996
[root@glynnis bin]#
Script done on Thu Nov  9 17:20:10 2000

pgsql-hackers by date:

Previous
From: Alfred Perlstein
Date:
Subject: Re: 7.0.2 dies when connection dropped mid-transaction
Next
From: Hiroshi Inoue
Date:
Subject: Re: Re: Recursive use of syscaches (was: relation ### modified while in use)