Re: [HACKERS] mysql_fdw + PG10: unrecognized node type: 217

2017-09-11 Thread Christoph Berg
Re: To Andres Freund 2017-09-11 <20170911095338.mqkiinkpk7gko...@msg.df7cb.de>
> Re: Andres Freund 2017-09-11 
> <20170911090306.s7sj4uyr4t72w...@alap3.anarazel.de>
> > Could you pprint() the expression that's being initialized?
> (gdb) p pprint(node)

Andres helped me to produce a correct dump, my error was that the
breakpoint should have been one line earlier because of elog()
internals.

The outcome is that Andres diagnosed it as a bug in mysql_fdw;
ExecInitExpr() should never get toplevel lists anymore.

Bug filed: https://github.com/EnterpriseDB/mysql_fdw/issues/147

Thanks,
Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] mysql_fdw + PG10: unrecognized node type: 217

2017-09-11 Thread Christoph Berg
Re: Andres Freund 2017-09-11 <20170911090306.s7sj4uyr4t72w...@alap3.anarazel.de>
> Could you pprint() the expression that's being initialized?

(gdb) f 4
#4  0x5604ecedd124 in ExecInitNode (node=node@entry=0x5604ee884f80, 
estate=estate@entry=0x5604ee8c78a0, 
eflags=eflags@entry=16) at 
./build/../src/backend/executor/execProcnode.c:164
164 ./build/../src/backend/executor/execProcnode.c: Datei oder Verzeichnis 
nicht gefunden.
(gdb) p pprint(node)
$1 = void


2017-09-11 11:27:53.268 CEST [31066] postgres@postgres ANWEISUNG:  SELECT 
test_param_where();
   {RESULT 
   :startup_cost 0.00 
   :total_cost 0.26 
   :plan_rows 1 
   :plan_width 4 
   :parallel_aware false 
   :parallel_safe false 
   :plan_node_id 0 
   :targetlist (
  {TARGETENTRY 
  :expr 
 {FUNCEXPR 
 :funcid 16402 
 :funcresulttype 2278 
 :funcretset false 
 :funcvariadic false 
 :funcformat 0 
 :funccollid 0 
 :inputcollid 0 
 :args <> 
 :location 7
 }
  :resno 1 
  :resname test_param_where 
  :ressortgroupref 0 
  :resorigtbl 0 
  :resorigcol 0 
  :resjunk false
  }
   )
   :qual <> 
   :lefttree <> 
   :righttree <> 
   :initPlan <> 
   :extParam (b)
   :allParam (b)
   :resconstantqual <>
   }


Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] mysql_fdw + PG10: unrecognized node type: 217

2017-09-11 Thread Andres Freund
Hi,

On 2017-09-11 10:53:39 +0200, Christoph Berg wrote:
> Re: To Tom Lane 2017-09-11 <20170911083136.stdnc4w52wk3o...@msg.df7cb.de>
> > postgres=# select test_param_where();
> > FEHLER:  XX000: unrecognized node type: 217
> > KONTEXT:  SQL-Anweisung »select bfrom numbers where a=x«
> > PL/pgSQL-Funktion test_param_where() Zeile 6 bei SQL-Anweisung
> > ORT:  ExecInitExprRec, execExpr.c:2031
> 
> The problem happens on the 6th iteration of this loop:
> 
> CREATE FOREIGN TABLE numbers(a int, b varchar(255)) SERVER mysql_svr OPTIONS 
> (dbname 'testdb', table_name 'numbers');
> 
> create or replace function test_param_where() returns void as $$
> DECLARE
>   n varchar;
> BEGIN
>   FOR x IN 1..9 LOOP
> select b into n from numbers where a=x;
> raise notice 'Found number %', n;
>   end loop;
>   return;
> END
> $$ LANGUAGE plpgsql;
> 
> SELECT test_param_where();
> 
> ***
> *** 345,368 
>   NOTICE:  Found number Three
>   NOTICE:  Found number Four
>   NOTICE:  Found number Five
> ! NOTICE:  Found number Six
> ! NOTICE:  Found number Seven
> ! NOTICE:  Found number Eight
> ! NOTICE:  Found number Nine
> !  test_param_where 
> ! --
> !  
> ! (1 row)
> ! 
>   DELETE FROM employee;
> ...
> --- 344,365 
>   NOTICE:  Found number Three
>   NOTICE:  Found number Four
>   NOTICE:  Found number Five
> ! ERROR:  unrecognized node type: 217
> ! CONTEXT:  SQL statement "select bfrom numbers where a=x"
> ! PL/pgSQL function test_param_where() line 6 at SQL statement
> ! /*

Could you pprint() the expression that's being initialized?

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] mysql_fdw + PG10: unrecognized node type: 217

2017-09-11 Thread Christoph Berg
Re: To Tom Lane 2017-09-11 <20170911083136.stdnc4w52wk3o...@msg.df7cb.de>
> postgres=# select test_param_where();
> FEHLER:  XX000: unrecognized node type: 217
> KONTEXT:  SQL-Anweisung »select bfrom numbers where a=x«
> PL/pgSQL-Funktion test_param_where() Zeile 6 bei SQL-Anweisung
> ORT:  ExecInitExprRec, execExpr.c:2031

The problem happens on the 6th iteration of this loop:

CREATE FOREIGN TABLE numbers(a int, b varchar(255)) SERVER mysql_svr OPTIONS 
(dbname 'testdb', table_name 'numbers');

create or replace function test_param_where() returns void as $$
DECLARE
  n varchar;
BEGIN
  FOR x IN 1..9 LOOP
select b into n from numbers where a=x;
raise notice 'Found number %', n;
  end loop;
  return;
END
$$ LANGUAGE plpgsql;

SELECT test_param_where();

***
*** 345,368 
  NOTICE:  Found number Three
  NOTICE:  Found number Four
  NOTICE:  Found number Five
! NOTICE:  Found number Six
! NOTICE:  Found number Seven
! NOTICE:  Found number Eight
! NOTICE:  Found number Nine
!  test_param_where 
! --
!  
! (1 row)
! 
  DELETE FROM employee;
...
--- 344,365 
  NOTICE:  Found number Three
  NOTICE:  Found number Four
  NOTICE:  Found number Five
! ERROR:  unrecognized node type: 217
! CONTEXT:  SQL statement "select bfrom numbers where a=x"
! PL/pgSQL function test_param_where() line 6 at SQL statement
! /*
  DELETE FROM employee;
...

Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] mysql_fdw + PG10: unrecognized node type: 217

2017-09-11 Thread Christoph Berg
Re: Tom Lane 2017-09-10 <13662.1505077...@sss.pgh.pa.us>
> Christoph Berg  writes:
> > I'm not sure if this is a bug in mysql_fdw, or in PG10:
> 
> > ! ERROR:  unrecognized node type: 217
> 
> Hm, nodetag 217 is T_List according to gdb.  Wouldn't expect that
> failure in very many places.  If you could get a stack trace from
> the errfinish call, it might help narrow things down.
> 
> Offhand my bet is on mysql_fdw needing an update for some PG10
> change, but that's just a guess.

postgres=# select test_param_where();
FEHLER:  XX000: unrecognized node type: 217
KONTEXT:  SQL-Anweisung »select bfrom numbers where a=x«
PL/pgSQL-Funktion test_param_where() Zeile 6 bei SQL-Anweisung
ORT:  ExecInitExprRec, execExpr.c:2031

(gdb) b execExpr.c:2031
Breakpoint 2 at 0x55d5a728e530: file 
./build/../src/backend/executor/execExpr.c, line 2031.
(gdb) c
Continuing.

Breakpoint 2, ExecInitExprRec (node=, 
parent=parent@entry=0x55d5a8766368, 
state=state@entry=0x55d5a87667d0, resv=resv@entry=0x55d5a87667d8, 
resnull=resnull@entry=0x55d5a87667d5 "")
at ./build/../src/backend/executor/execExpr.c:2034
2034./build/../src/backend/executor/execExpr.c: Datei oder Verzeichnis 
nicht gefunden.
(gdb) bt f
#0  ExecInitExprRec (node=, parent=parent@entry=0x55d5a8766368, 
state=state@entry=0x55d5a87667d0, 
resv=resv@entry=0x55d5a87667d8, resnull=resnull@entry=0x55d5a87667d5 "")
at ./build/../src/backend/executor/execExpr.c:2034
scratch = {opcode = 20, resvalue = 0x55d5a87667d8, resnull = 
0x55d5a87667d5 "", d = {fetch = {
  last_var = -1468635040}, var = {attnum = -1468635040, vartype = 
21973}, wholerow = {
  var = 0x55d5a8766860, first = -72 '\270', slow = 104 'h', 
  tupdesc = 0x7f9e21220140 , junkFilter = 
0x55d5}, assign_var = {
  resultnum = -1468635040, attnum = 21973}, assign_tmp = {resultnum 
= -1468635040}, constval = {
  value = 94376142727264, isnull = -72 '\270'}, func = {finfo = 
0x55d5a8766860, 
  fcinfo_data = 0x55d5a87668b8, fn_addr = 0x7f9e21220140 
, nargs = 0}, boolexpr = {
  anynull = 0x55d5a8766860 "@\001\"!\236\177", jumpdone = 
-1468634952}, qualexpr = {
  jumpdone = -1468635040}, jump = {jumpdone = -1468635040}, 
nulltest_row = {argdesc = 0x55d5a8766860}, 
param = {paramid = -1468635040, paramtype = 21973}, casetest = 
{value = 0x55d5a8766860, 
  isnull = 0x55d5a87668b8 "`hv\250\325U"}, make_readonly = {value = 
0x55d5a8766860, 
  isnull = 0x55d5a87668b8 "`hv\250\325U"}, iocoerce = {finfo_out = 
0x55d5a8766860, 
  fcinfo_data_out = 0x55d5a87668b8, finfo_in = 0x7f9e21220140 
, 
  fcinfo_data_in = 0x55d5}, sqlvaluefunction = {svf = 
0x55d5a8766860}, nextvalueexpr = {
  seqid = 2826332256, seqtypid = 21973}, arrayexpr = {elemvalues = 
0x55d5a8766860, 
  elemnulls = 0x55d5a87668b8 "`hv\250\325U", nelems = 555876672, 
elemtype = 32670, elemlength = 0, 
  elembyval = 0 '\000', elemalign = 0 '\000', multidims = -43 
'\325'}, arraycoerce = {
  coerceexpr = 0x55d5a8766860, resultelemtype = 2826332344, 
  elemfunc = 0x7f9e21220140 , amstate = 
0x55d5}, row = {
  tupdesc = 0x55d5a8766860, elemvalues = 0x55d5a87668b8, 
  elemnulls = 0x7f9e21220140  
"UH\211\345ATSH\201", }, 
rowcompare_step = {finfo = 0x55d5a8766860, fcinfo_data = 
0x55d5a87668b8, 
  fn_addr = 0x7f9e21220140 , jumpnull = 0, 
jumpdone = 21973}, rowcompare_final = {
  rctype = 2826332256}, minmax = {values = 0x55d5a8766860, nulls = 
0x55d5a87668b8 "`hv\250\325U", 
  nelems = 555876672, op = (unknown: 32670), finfo = 
0x55d5, fcinfo_data = 0x55d5a86d5df8}, 
fieldselect = {fieldnum = 26720, resulttype = 21973, argdesc = 
0x55d5a87668b8}, fieldstore = {
  fstore = 0x55d5a8766860, argdesc = 0x55d5a87668b8, values = 
0x7f9e21220140 , 
  nulls = 0x55d5 , 
  ncolumns = -1469227528}, arrayref_subscript = {state = 
0x55d5a8766860, off = -1468634952, 
  isupper = -43 '\325', jumpdone = 555876672}, arrayref = {state = 
0x55d5a8766860}, domaincheck = {
  constraintname = 0x55d5a8766860 "@\001\"!\236\177", checkvalue = 
0x55d5a87668b8, 
  checknull = 0x7f9e21220140  
"UH\211\345ATSH\201", , 
  resulttype = 0}, convert_rowtype = {convert = 0x55d5a8766860, 
indesc = 0x55d5a87668b8, 
  outdesc = 0x7f9e21220140 , map = 
0x55d5, initialized = -8 '\370'}, 
scalararrayop = {element_type = 2826332256, useOr = -43 '\325', 
typlen = 0, typbyval = -72 '\270', 
  typalign = 104 'h', finfo = 0x7f9e21220140 
, fcinfo_data = 0x55d5, 
  fn_addr = 0x55d5a86d5df8}, xmlexpr = {xexpr = 0x55d5a8766860, 
named_argvalue = 0x55d5a87668b8, 
  named_argnull = 0x7f9e21

Re: [HACKERS] mysql_fdw + PG10: unrecognized node type: 217

2017-09-10 Thread Tom Lane
Christoph Berg  writes:
> I'm not sure if this is a bug in mysql_fdw, or in PG10:

> ! ERROR:  unrecognized node type: 217

Hm, nodetag 217 is T_List according to gdb.  Wouldn't expect that
failure in very many places.  If you could get a stack trace from
the errfinish call, it might help narrow things down.

Offhand my bet is on mysql_fdw needing an update for some PG10
change, but that's just a guess.

regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] mysql_fdw + PG10: unrecognized node type: 217

2017-09-10 Thread Christoph Berg
Hi,

I'm not sure if this is a bug in mysql_fdw, or in PG10:

== running regression test queries==
test mysql_fdw... FAILED

*** 345,359 
  NOTICE:  Found number Three
  NOTICE:  Found number Four
  NOTICE:  Found number Five
! NOTICE:  Found number Six
! NOTICE:  Found number Seven
! NOTICE:  Found number Eight
! NOTICE:  Found number Nine
!  test_param_where 
! --
!  
! (1 row)
! 
  DELETE FROM employee;
  DELETE FROM department;
  DELETE FROM empdata;
--- 344,352 
  NOTICE:  Found number Three
  NOTICE:  Found number Four
  NOTICE:  Found number Five
! ERROR:  unrecognized node type: 217
! CONTEXT:  SQL statement "select bfrom numbers where a=x"
! PL/pgSQL function test_param_where() line 6 at SQL statement
  DELETE FROM employee;
  DELETE FROM department;
  DELETE FROM empdata;

mysql_fdw master at 7d084c59, PG10 at 6913d066.


The testsuite was running against this mysql schema:

CREATE DATABASE testdb;
USE testdb;

CREATE USER 'foo'@'127.0.0.1' IDENTIFIED BY 'bar';
GRANT ALL PRIVILEGES ON testdb.* TO 'foo'@'127.0.0.1';

CREATE TABLE department(department_id int, department_name text, PRIMARY KEY 
(department_id));
CREATE TABLE employee(emp_id int, emp_name text, emp_dept_id int, PRIMARY KEY 
(emp_id));
CREATE TABLE empdata (emp_id int, emp_dat blob, PRIMARY KEY (emp_id));
CREATE TABLE numbers(a int PRIMARY KEY, b varchar(255));

Christoph


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers