Re: Fwd: Proposal: variant of regclass

Поиск
Список
Период
Сортировка
От Yugo Nagata
Тема Re: Fwd: Proposal: variant of regclass
Дата
Msg-id 20140124123527.bcb67a6d.nagata@sraoss.co.jp
обсуждение исходный текст
Ответ на Re: Proposal: variant of regclass  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Fwd: Proposal: variant of regclass  (Yugo Nagata <nagata@sraoss.co.jp>)
Список pgsql-hackers
On Thu, 23 Jan 2014 13:19:37 +0200
Marti Raudsepp <marti@juffo.org> wrote:

> Resending to Tatsuo Ishii and Yugo Nagata, your email server was
> having problems yesterday:

Thanks for resending!

>
> This is the mail system at host sraigw2.sra.co.jp.
>
> <yugo-n@sranhm.sra.co.jp>: mail for srasce.sra.co.jp loops back to myself
> <t-ishii@sra.co.jp>: mail for srasce.sra.co.jp loops back to myself
>
> ---------- Forwarded message ----------
> From: Marti Raudsepp <marti@juffo.org>
> Date: Thu, Jan 23, 2014 at 3:39 AM
> Subject: Re: [HACKERS] Proposal: variant of regclass
> To: Yugo Nagata <nagata@sraoss.co.jp>
> Cc: Tatsuo Ishii <ishii@postgresql.org>, pgsql-hackers
> <pgsql-hackers@postgresql.org>, Vik Fearing <vik.fearing@dalibo.com>,
> Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>,
> Pavel Golub <pavel@gf.microolap.com>, Pavel Golub
> <pavel@microolap.com>, Andres Freund <andres@2ndquadrant.com>, Pavel
> Stěhule <pavel.stehule@gmail.com>
>
>
> On Wed, Jan 22, 2014 at 1:44 PM, Yugo Nagata <nagata@sraoss.co.jp> wrote:
> > On Wed, 22 Jan 2014 20:04:12 +0900 (JST)
> > Tatsuo Ishii <ishii@postgresql.org> wrote:
> > parseTypeString() is called by some other functions and I avoided
> > influences of modifying the definition on them, since this should
> > raise errors in most cases. This is same reason for other *MissingOk
> > functions in parse_type.c.
> >
> > Is it better to write definitions of these function and all there callers?
>
> Yes, for parseTypeString certainly. There have been many refactorings
> like that in the past and all of them use this pattern.

Ok. I'll rewrite the definition and there callers.

>
> typenameTypeIdAndMod is less clear since the code paths differ so
> much, maybe keep 2 versions (merging back to 1 function is OK too, but
> in any case you don't need 3).

I'll also fix this in either way to not use typenameTypeIdAndMod_guts.

>
> typenameTypeIdAndModMissingOk(...)
> {
>     Type tup = LookupTypeName(pstate, typeName, typmod_p);
>     if (tup == NULL || !((Form_pg_type) GETSTRUCT(tup))->typisdefined)
>         *typeid_p = InvalidOid;
>     else
>         *typeid_p = HeapTupleGetOid(tup);
>
>     if (tup)
>         ReleaseSysCache(tup);
> }
> typenameTypeIdAndMod(...)
> {
>     Type tup = typenameType(pstate, typeName, typmod_p);
>     *typeid_p = HeapTupleGetOid(tup);
>     ReleaseSysCache(tup);
> }
>
> ----
>
> Also, there's no need for "else" here:
>     if (raiseError)
>         ereport(ERROR, ...);
>     else
>         return InvalidOid;
>
> Regards,
> Marti


--
Yugo Nagata <nagata@sraoss.co.jp>



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Postgresql for cygwin - 3rd
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Change authentication error message (patch)