Re: Why does array_position_common bitwise NOT an Oid type?
| От | Tom Lane |
|---|---|
| Тема | Re: Why does array_position_common bitwise NOT an Oid type? |
| Дата | |
| Msg-id | 23769.1513475624@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Why does array_position_common bitwise NOT an Oid type? (David Rowley <david.rowley@2ndquadrant.com>) |
| Ответы |
Re: Why does array_position_common bitwise NOT an Oid type?
|
| Список | pgsql-hackers |
David Rowley <david.rowley@2ndquadrant.com> writes:
> I was puzzled to see the following code:
> my_extra->element_type = ~element_type;
> It looks quite wrong, but if its right then I think it needs a comment
> to explain it. I don't see any in the area which mentions it. My best
> guess would be that it's using this to know if the type data has been
> cached, but then why would it not use InvalidOid for that?
If memory serves, the idea was to force the subsequent datatype-lookup
path to be taken, even if for some reason element_type is InvalidOid.
If we take the lookup path then the bogus element_type will be detected
and reported; if we don't, it won't be.
We could instead add an explicit test for element_type == InvalidOid,
but that's just more duplicative code.
regards, tom lane
В списке pgsql-hackers по дате отправления: