Re: DOMAINs and CASTs

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: DOMAINs and CASTs
Дата
Msg-id 201111290246.pAT2k7Z11795@momjian.us
обсуждение исходный текст
Ответ на Re: DOMAINs and CASTs  (David Fetter <david@fetter.org>)
Ответы Re: DOMAINs and CASTs
Список pgsql-hackers
David Fetter wrote:
> On Mon, Jun 13, 2011 at 03:39:39AM -0500, Jaime Casanova wrote:
> > On Mon, Jun 6, 2011 at 6:36 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
> > > On tis, 2011-05-17 at 14:11 -0500, Jaime Casanova wrote:
> > >> On Tue, May 17, 2011 at 12:19 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> > >> >
> > >> > The more controversial question is what to do if someone tries to
> > >> > create such a cast anyway. ?We could just ignore that as we do now, or
> > >> > we could throw a NOTICE, WARNING, or ERROR.
> > >>
> > >> IMHO, not being an error per se but an implementation limitation i
> > >> would prefer to send a WARNING
> > >
> > > Implementation limitations are normally reported as errors. ?I don't see
> > > why it should be different here.
> > >
> >
> > ok, patch reports an error... do we want to backpatch this? if we want
> > to do so maybe we can backpatch as a warning
>
> Minor clarification attached.

What happened to this patch for casts on domains from June?

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 03da168..a29c13c 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -1517,6 +1517,17 @@ CreateCast(CreateCastStmt *stmt)
                                 errmsg("target data type %s is a pseudo-type",
                                                TypeNameToString(stmt->targettype))));

+       /* no domains allowd */
+       if (sourcetyptype == TYPTYPE_DOMAIN)
+               ereport(ERROR,
+                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                errmsg("casts from domains are not implemented yet")));
+
+       if (targettyptype == TYPTYPE_DOMAIN)
+               ereport(ERROR,
+                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                errmsg("casts to domains are not implemented yet")));
+
        /* Permission check */
        if (!pg_type_ownercheck(sourcetypeid, GetUserId())
                && !pg_type_ownercheck(targettypeid, GetUserId()))
@@ -1672,11 +1683,13 @@ CreateCast(CreateCastStmt *stmt)
                 * etc. would have to be modified to look through domains to their
                 * base types.
                 */
+#ifdef NOT_USED
                if (sourcetyptype == TYPTYPE_DOMAIN ||
                        targettyptype == TYPTYPE_DOMAIN)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
                                         errmsg("domain data types must not be marked binary-compatible")));
+#endif
        }

        /*

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Allow pg_dumpall to use dumpmem.c functions, simplify exit code
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: WIP: collect frequency statistics for arrays