Re: SQL:2011 application time
От | jian he |
---|---|
Тема | Re: SQL:2011 application time |
Дата | |
Msg-id | CACJufxGt4oYfa7UN2eAXymgOKH1irbhC5eY_oNkkdj30w-fefw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: SQL:2011 application time (jian he <jian.universality@gmail.com>) |
Ответы |
Re: SQL:2011 application time
|
Список | pgsql-hackers |
hi. also based on v16. -----------------tests. drop table if exists for_portion_of_test1; CREATE unlogged TABLE for_portion_of_test1 (id int4range, valid_at tsrange,name text ); INSERT INTO for_portion_of_test1 VALUES ('[1,1]', NULL, '[1,1]_NULL'),('[1,1]', '(,)', '()_[1,]') ,('[1,1]', 'empty', '[1,1]_empty'),(NULL,NULL, NULL), (nuLL, '(2018-01-01,2019-01-01)','misc'); --1 UPDATE for_portion_of_test1 FOR PORTION OF valid_at FROM NULL TO NULL SET name = 'for_portition_NULLtoNULL'; select * from for_portion_of_test1; --2 UPDATE for_portion_of_test1 FOR PORTION OF valid_at FROM null TO UNBOUNDED SET name = 'NULL_TO_UNBOUNDED'; select * from for_portion_of_test1; --3 UPDATE for_portion_of_test1 FOR PORTION OF valid_at FROM UNBOUNDED TO null SET name = 'UNBOUNDED__TO_NULL'; select * from for_portion_of_test1; --4 UPDATE for_portion_of_test1 FOR PORTION OF valid_at FROM UNBOUNDED TO UNBOUNDED SET name = 'UNBOUNDED__TO_UNBOUNDED'; select * from for_portion_of_test1; ------------------------ File: /src/backend/executor/nodeModifyTable.c 1277: oldRange = slot_getattr(oldtupleSlot, forPortionOf->rangeVar->varattno, &isNull); 1278: 1279: if (isNull) 1280: elog(ERROR, "found a NULL range in a temporal table"); 1281: oldRangeType = DatumGetRangeTypeP(oldRange); I wonder when this isNull will be invoked. the above tests won't invoke the error. also the above test, NULL seems equivalent to unbounded. FOR PORTION OF "from" and "to" both bound should not be null? which means the following code does not work as intended? I also cannot find a way to invoke the following elog error branch. File:src/backend/executor/nodeModifyTable.c 4458: exprState = ExecPrepareExpr((Expr *) forPortionOf->targetRange, estate); 4459: targetRange = ExecEvalExpr(exprState, econtext, &isNull); 4460: if (isNull) 4461: elog(ERROR, "Got a NULL FOR PORTION OF target range"); --------------------------- i also made some changes in the function range_leftover_internal, ExecForPortionOfLeftovers. please see the attached patch.
Вложения
В списке pgsql-hackers по дате отправления: