You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "longgeligelong (JIRA)" <ji...@apache.org> on 2016/01/08 04:31:39 UTC

[jira] [Created] (HAWQ-328) plsql loop three times exit abnormality

longgeligelong created HAWQ-328:
-----------------------------------

             Summary: plsql loop three times exit abnormality
                 Key: HAWQ-328
                 URL: https://issues.apache.org/jira/browse/HAWQ-328
             Project: Apache HAWQ
          Issue Type: Bug
          Components: Catalog
            Reporter: longgeligelong
            Assignee: Lei Chang


plsql of hawq loop three times exit abnormality. 
Add print in code, Then I found when program looped third time, before running line 824 in src/backend/executor/execMain.c, the value of queryDesc->plannedstmt->resource->type is 1050. After running this line the value  became a random number. But after running this line in the tirst two loop, the value  is still 1050. Because queryDesc is not a actual parameter of prepareDispatchedCatalogRelation in line 824, I cannot  continue to keep track of code. 

stdour and stderr  as below :

psql:test_plsql_loop.sql:66: NOTICE:  for loop: quantity here is 1
psql:test_plsql_loop.sql:66: NOTICE:  FOR LOOP: ROW HERE IS (14929)
psql:test_plsql_loop.sql:66: NOTICE:  for loop: quantity here is 2
psql:test_plsql_loop.sql:66: NOTICE:  FOR LOOP: row here is (14929)
psql:test_plsql_loop.sql:66: NOTICE:  for loop: quantity here is 3
psql:test_plsql_loop.sql:66: ERROR:  could not serialize unrecognized node type: 38814640 (outfast.c:4742)
CONTEXT:  SQL statement "SELECT COUNT(1) FROM oiq_t_2"
PL/pgSQL function "func2" line 11 at SQL statement

plsql code as below:

CREATE OR REPLACE FUNCTION func2(integer) RETURNS text AS $func$
DECLARE
    quantity integer;
    rowvar1 RECORD;
    effect_num integer;
BEGIN
    quantity := $1;
    <<fst_loop>>
    FOR i IN 1..10 LOOP
        RAISE NOTICE 'for loop: quantity here is %', quantity;
        IF quantity > 1 and quantity < 5 THEN
            SELECT COUNT(1) INTO rowvar1 FROM oiq_t_2;
            RAISE NOTICE 'FOR LOOP: row here is %', rowvar1;
        ELSE
            SELECT COUNT(1) INTO rowvar1 FROM oiq_t_2;
            RAISE NOTICE 'FOR LOOP: ROW HERE IS %', rowvar1;
        END IF;
        quantity := quantity + 1;
    END LOOP fst_loop;
    return rowvar1;
END;
$func$ LANGUAGE plpgsql;
select func2(1);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)