BUG #3422: Segmentation violation in PL/pgSQL - Mailing list pgsql-bugs

From Holger Schurig
Subject BUG #3422: Segmentation violation in PL/pgSQL
Date
Msg-id 200706301811.l5UIB8us064915@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #3422: Segmentation violation in PL/pgSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      3422
Logged by:          Holger Schurig
Email address:      hs4233@mail.mn-solutions.de
PostgreSQL version: PostgreSQL 8.3d
Operating system:   Linux
Description:        Segmentation violation in PL/pgSQL
Details:

PostgreSQL CVS from today

Skytools (http://pgfoundry.org/scm/?group_id=1000206) from today

After "make" && "make install" of PostgreSQL, I set PGDATA, run "initdb"
without any parameters. Then, in skytools, I do "configure". Because I'm
just interested in PyQ, I change the SUBDIRS variable in
skytools/sql/Makefile to only contain "pgq pgq_ext txid". After this, I run
"make" && "make install".

Now I run "postgres -d5" (standard postgresql.conf file from initdb). In
skytools/sql/pgdb I run "make test". Now I can observe a segmentation
violation.

The last lines of the "-d5" output are:

DEBUG:  plan:
DETAIL:  {PLANNEDSTMT :commandType 1 :canSetTag true :planTree {MERGEJOIN
:startup_cost
        124.66 :total_cost 204.66 :plan_rows 25 :plan_width 8 :targetlist
        ({TARGETENTRY :expr {VAR :varno 65001 :varattno 1 :vartype 20
:vartypmod -1
        :varlevelsup 0 :varnoold 1 :varoattno 1} :resno 1 :resname id1
        :ressortgroupref 1 :resorigtbl 0 :resorigcol 0 :resjunk false})
:qual
        ({NULLTEST :arg {VAR :varno 65000 :varattno 1 :vartype 20 :vartypmod
-1
        :varlevelsup 0 :varnoold 2 :varoattno 1} :nulltesttype 0}) :lefttree
{SORT
        :startup_cost 62.33 :total_cost 64.83 :plan_rows 1000 :plan_width 8
        :targetlist ({TARGETENTRY :expr {VAR :varno 65001 :varattno 1
:vartype 20
        :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1} :resno 1
:resname <>
        :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false})
:qual <>
        :lefttree {FUNCTIONSCAN :startup_cost 0.00 :total_cost 12.50
:plan_rows 1000
        :plan_width 8 :targetlist ({TARGETENTRY :expr {VAR :varno 1
:varattno 1
        :vartype 20 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1}
:resno 1
        :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk
false})
        :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b)
:allParam (b)
        :scanrelid 1 :funcexpr {FUNCEXPR :funcid 41492 :funcresulttype 20
:funcretset
        true :funcformat 0 :args ({PARAM :paramkind 0 :paramid 1 :paramtype
41484
        :paramtypmod -1})} :funccolnames ("id1") :funccoltypes <>
:funccoltypmods <>}
        :righttree <> :initPlan <> :extParam (b) :allParam (b) :numCols 1
:sortColIdx
        1 :sortOperators 413 :nullsFirst true} :righttree {SORT
:startup_cost 62.33
        :total_cost 64.83 :plan_rows 1000 :plan_width 8 :targetlist
({TARGETENTRY
        :expr {VAR :varno 65001 :varattno 1 :vartype 20 :vartypmod -1
:varlevelsup 0
        :varnoold 2 :varoattno 1} :resno 1 :resname <> :ressortgroupref 0
:resorigtbl
        0 :resorigcol 0 :resjunk false}) :qual <> :lefttree {FUNCTIONSCAN
        :startup_cost 0.00 :total_cost 12.50 :plan_rows 1000 :plan_width 8
:targetlist
        ({TARGETENTRY :expr {VAR :varno 2 :varattno 1 :vartype 20 :vartypmod
-1
        :varlevelsup 0 :varnoold 2 :varoattno 1} :resno 1 :resname <>
:ressortgroupref
        0 :resorigtbl 0 :resorigcol 0 :resjunk false}) :qual <> :lefttree
<>
        :righttree <> :initPlan <> :extParam (b) :allParam (b) :scanrelid 2
:funcexpr
        {FUNCEXPR :funcid 41492 :funcresulttype 20 :funcretset true
:funcformat 0
        :args ({PARAM :paramkind 0 :paramid 2 :paramtype 41484 :paramtypmod
-1})}
        :funccolnames ("id2") :funccoltypes <> :funccoltypmods <>}
:righttree <>
        :initPlan <> :extParam (b) :allParam (b) :numCols 1 :sortColIdx 1
        :sortOperators 413 :nullsFirst true} :initPlan <> :extParam (b)
:allParam (b)
        :jointype 1 :joinqual <> :mergeclauses ({OPEXPR :opno 410 :opfuncid
467
        :opresulttype 16 :opretset false :args ({VAR :varno 65001 :varattno
1 :vartype
        20 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1} {VAR
:varno 65000
        :varattno 1 :vartype 20 :vartypmod -1 :varlevelsup 0 :varnoold 2
:varoattno
        1})}) :mergeFamilies 1976 :mergeStrategies 5 :mergeNullsFirst 1}
:rtable ({RTE
        :alias {ALIAS :aliasname id1 :colnames <>} :eref {ALIAS :aliasname
id1
        :colnames ("id1")} :rtekind 4 :funcexpr <> :funccoltypes <>
:funccoltypmods <>
        :inh false :inFromCl true :requiredPerms 2 :checkAsUser 0} {RTE
:alias {ALIAS
        :aliasname id2 :colnames <>} :eref {ALIAS :aliasname id2 :colnames
("id2")}
        :rtekind 4 :funcexpr <> :funccoltypes <> :funccoltypmods <> :inh
false
        :inFromCl true :requiredPerms 2 :checkAsUser 0} {RTE :alias <> :eref
{ALIAS
        :aliasname unnamed_join :colnames ("id1" "id2")} :rtekind 2
:jointype 1
        :joinaliasvars <> :inh false :inFromCl true :requiredPerms 2
:checkAsUser 0})
        :resultRelations <> :utilityStmt <> :intoClause <> :subplans <>
:rewindPlanIDs
        (b) :returningLists <> :rowMarks <> :nParamExec 0}
CONTEXT:  SQL statement " select id1 from get_snapshot_active( $1 ) id1
left
join get_snapshot_active( $2 ) id2 on (id1 = id2) where id2 is null order
by
1 desc"
        PL/pgSQL function "batch_event_sql" line 66 at for over select rows
        PL/pgSQL function "get_batch_events" line 17 at assignment
DEBUG:  reaping dead processes
DEBUG:  server process (PID 19148) was terminated by signal 11: Segmentation
fault
LOG:  server process (PID 19148) was terminated by signal 11: Segmentation
fault
LOG:  terminating any other active server processes
DEBUG:  sending SIGQUIT to process 19095
DEBUG:  sending SIGQUIT to process 19097
DEBUG:  sending SIGQUIT to process 19096
DEBUG:  reaping dead processes
DEBUG:  reaping dead processes
LOG:  all server processes terminated; reinitializing

pgsql-bugs by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: BUG #3423: cache on temporary tables in plpgsql
Next
From: "Jaime Casanova"
Date:
Subject: Fwd: BUG #3421: Failed to create temporary batch file