Heikki Linnakangas <heikki.linnakan...@enterprisedb.com> writes: > On 09.08.2011 18:04, Alvaro Herrera wrote: >> I think I vaguely remember that the reason for doing it this way is that >> the copy into the relcache worked, i.e. if the originals went away, >> there was no dangling pointer. Did you test this?
> These strings are never freed, so I don't think it's possible to end up > with a dangling pointer. Well, in that case the relevant question is whether we need to worry about memory leaks due to multiple copies. Personally I'm wondering why the function is strdup'ing the default value at all. In practice, wouldn't it practically always be a compile time constant string? Why create possible issues by designing the code for a different use-case? In particular, why not declare the default value as "const char *" and specify that it's caller's responsibility that it live forever if it's not just a constant string? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers