Re: Getting rid of CaseTestExpr (well, partially)
От | Tom Lane |
---|---|
Тема | Re: Getting rid of CaseTestExpr (well, partially) |
Дата | |
Msg-id | 364716.1738517055@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Getting rid of CaseTestExpr (well, partially) (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
I wrote: > Therefore, my proposal here is to leave the parser's usage of > CaseTestExpr alone, and replace CaseTestExprs with Params during > eval_const_expressions, just before any relevant function inlining > could happen. I thought of a nasty defect in this idea: CASE expressions that would have been seen as equal() may not be equal after the transformation. (The upper nodes are fine because we can make their *param fields be equal_ignore, but the lower PARAM_EXPRs won't match.) There's at least one important behavior this probably breaks, which is matching of index expressions containing a CASE or ArrayCoerce to query quals. That might be a rare use-case, but it'd annoy anyone doing it, and it'd be pretty hard to explain why it's not a bug. I spent some time wondering if we could somehow number the Params "bottom up" to fix this, so that (for example) a CASE would always use paramid 1 unless it contains one other CASE, which would cause it to use paramid 2, etc. I think eval_const_expressions could be made to do that, but it's not clear how to preserve the property during function inlining. But the main thing I don't like is that this would make it much less obvious that Params with overlapping lifespans have distinct IDs, which takes away a large part of the attraction of the whole design. Pending some better idea, I'm withdrawing this patch. regards, tom lane
В списке pgsql-hackers по дате отправления: