Ident nodetype considered harmful

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Ident nodetype considered harmful
Дата
Msg-id 16423.1029720422@sss.pgh.pa.us
обсуждение исходный текст
Список pgsql-hackers
I've just noticed that a bunch of places use strVal() to access the name
field of an Ident node.  (Try changing strVal() to

#define strVal(v)        (AssertMacro(IsA(v, String)), ((Value *)(v))->val.str)

and watch the fur fly...)

This works, at the moment, because Ident and Value nodes have a similar
layout.  But it sure looks like trouble waiting to happen.

As far as I can tell, there's no really good reason to keep Ident around
at all.  The only thing it's still used for is lists of column names in
a couple of statement types --- which is something that we do elsewhere
with lists of String nodes.  Indeed I imagine that the buggy places got
that way because someone copied-and-pasted code that was legitimately
dealing with a list of column names in String form.

Also, strVal() and makeString() provide handy notational infrastructure
that we don't have for Ident.

Considering these points, I'd rather rip out Ident and replace its uses
with String nodes than try to clean up the misuses of strVal().  Any
objections out there?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: ngpg@grymmjack.com
Дата:
Сообщение: Re: Open 7.3 items
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: About to update the PostgreSQL Functions in the official PHP Manual