Thread: pgsql-server: Make the world very nearly safe for composite-type columns

pgsql-server: Make the world very nearly safe for composite-type columns

From
tgl@svr1.postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Make the world very nearly safe for composite-type columns in tables.
1. Solve the problem of not having TOAST references hiding inside composite
values by establishing the rule that toasting only goes one level deep:
a tuple can contain toasted fields, but a composite-type datum that is
to be inserted into a tuple cannot.  Enforcing this in heap_formtuple
is relatively cheap and it avoids a large increase in the cost of running
the tuptoaster during final storage of a row.
2. Fix some interesting problems in expansion of inherited queries that
reference whole-row variables.  We never really did this correctly before,
but it's now relatively painless to solve by expanding the parent's
whole-row Var into a RowExpr() selecting the proper columns from the
child.
If you dike out the preventive check in CheckAttributeType(),
composite-type columns now seem to actually work.  However, we surely
cannot ship them like this --- without I/O for composite types, you
can't get pg_dump to dump tables containing them.  So a little more
work still to do.

Modified Files:
--------------
    pgsql-server/src/backend/access/common:
        heaptuple.c (r1.91 -> r1.92)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/access/common/heaptuple.c.diff?r1=1.91&r2=1.92)
    pgsql-server/src/backend/access/heap:
        tuptoaster.c (r1.42 -> r1.43)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/access/heap/tuptoaster.c.diff?r1=1.42&r2=1.43)
    pgsql-server/src/backend/optimizer/path:
        allpaths.c (r1.117 -> r1.118)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/allpaths.c.diff?r1=1.117&r2=1.118)
        costsize.c (r1.129 -> r1.130)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/costsize.c.diff?r1=1.129&r2=1.130)
        pathkeys.c (r1.59 -> r1.60)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/pathkeys.c.diff?r1=1.59&r2=1.60)
    pgsql-server/src/backend/optimizer/prep:
        prepunion.c (r1.112 -> r1.113)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/prep/prepunion.c.diff?r1=1.112&r2=1.113)
    pgsql-server/src/backend/optimizer/util:
        relnode.c (r1.59 -> r1.60)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/util/relnode.c.diff?r1=1.59&r2=1.60)
        tlist.c (r1.64 -> r1.65)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/util/tlist.c.diff?r1=1.64&r2=1.65)
    pgsql-server/src/backend/utils/cache:
        typcache.c (r1.6 -> r1.7)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/cache/typcache.c.diff?r1=1.6&r2=1.7)
    pgsql-server/src/include/access:
        tuptoaster.h (r1.17 -> r1.18)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/access/tuptoaster.h.diff?r1=1.17&r2=1.18)
    pgsql-server/src/include/nodes:
        relation.h (r1.95 -> r1.96)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/nodes/relation.h.diff?r1=1.95&r2=1.96)
    pgsql-server/src/include/utils:
        typcache.h (r1.3 -> r1.4)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/utils/typcache.h.diff?r1=1.3&r2=1.4)

Re: pgsql-server: Make the world very nearly safe for composite-type

From
Bruce Momjian
Date:
Does this complete this TODO item?

    * Support composite types as table columns


---------------------------------------------------------------------------

Tom Lane wrote:
> Log Message:
> -----------
> Make the world very nearly safe for composite-type columns in tables.
> 1. Solve the problem of not having TOAST references hiding inside composite
> values by establishing the rule that toasting only goes one level deep:
> a tuple can contain toasted fields, but a composite-type datum that is
> to be inserted into a tuple cannot.  Enforcing this in heap_formtuple
> is relatively cheap and it avoids a large increase in the cost of running
> the tuptoaster during final storage of a row.
> 2. Fix some interesting problems in expansion of inherited queries that
> reference whole-row variables.  We never really did this correctly before,
> but it's now relatively painless to solve by expanding the parent's
> whole-row Var into a RowExpr() selecting the proper columns from the
> child.
> If you dike out the preventive check in CheckAttributeType(),
> composite-type columns now seem to actually work.  However, we surely
> cannot ship them like this --- without I/O for composite types, you
> can't get pg_dump to dump tables containing them.  So a little more
> work still to do.
>
> Modified Files:
> --------------
>     pgsql-server/src/backend/access/common:
>         heaptuple.c (r1.91 -> r1.92)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/access/common/heaptuple.c.diff?r1=1.91&r2=1.92)
>     pgsql-server/src/backend/access/heap:
>         tuptoaster.c (r1.42 -> r1.43)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/access/heap/tuptoaster.c.diff?r1=1.42&r2=1.43)
>     pgsql-server/src/backend/optimizer/path:
>         allpaths.c (r1.117 -> r1.118)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/allpaths.c.diff?r1=1.117&r2=1.118)
>         costsize.c (r1.129 -> r1.130)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/costsize.c.diff?r1=1.129&r2=1.130)
>         pathkeys.c (r1.59 -> r1.60)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/pathkeys.c.diff?r1=1.59&r2=1.60)
>     pgsql-server/src/backend/optimizer/prep:
>         prepunion.c (r1.112 -> r1.113)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/prep/prepunion.c.diff?r1=1.112&r2=1.113)
>     pgsql-server/src/backend/optimizer/util:
>         relnode.c (r1.59 -> r1.60)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/util/relnode.c.diff?r1=1.59&r2=1.60)
>         tlist.c (r1.64 -> r1.65)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/util/tlist.c.diff?r1=1.64&r2=1.65)
>     pgsql-server/src/backend/utils/cache:
>         typcache.c (r1.6 -> r1.7)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/cache/typcache.c.diff?r1=1.6&r2=1.7)
>     pgsql-server/src/include/access:
>         tuptoaster.h (r1.17 -> r1.18)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/access/tuptoaster.h.diff?r1=1.17&r2=1.18)
>     pgsql-server/src/include/nodes:
>         relation.h (r1.95 -> r1.96)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/nodes/relation.h.diff?r1=1.95&r2=1.96)
>     pgsql-server/src/include/utils:
>         typcache.h (r1.3 -> r1.4)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/utils/typcache.h.diff?r1=1.3&r2=1.4)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pgsql-server: Make the world very nearly safe for composite-type

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Does this complete this TODO item?
>     * Support composite types as table columns

Was "we surely cannot ship them like this" not clear enough?

>> If you dike out the preventive check in CheckAttributeType(),
>> composite-type columns now seem to actually work.  However, we surely
>> cannot ship them like this --- without I/O for composite types, you
>> can't get pg_dump to dump tables containing them.  So a little more
>> work still to do.

            regards, tom lane

Re: pgsql-server: Make the world very nearly safe for composite-type

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Does this complete this TODO item?
> >     * Support composite types as table columns
>
> Was "we surely cannot ship them like this" not clear enough?
>
> >> If you dike out the preventive check in CheckAttributeType(),
> >> composite-type columns now seem to actually work.  However, we surely
> >> cannot ship them like this --- without I/O for composite types, you
> >> can't get pg_dump to dump tables containing them.  So a little more
> >> work still to do.

My question is whether we are getting closer to completing this item.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pgsql-server: Make the world very nearly safe for composite-type

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> My question is whether we are getting closer to completing this item.

We're so close I can smell it ;-) ... but not there yet.  We gotta
agree on an external I/O representation for composite data values,
and then implement that.

            regards, tom lane

Re: pgsql-server: Make the world very nearly safe for composite-type

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > My question is whether we are getting closer to completing this item.
>
> We're so close I can smell it ;-) ... but not there yet.  We gotta
> agree on an external I/O representation for composite data values,
> and then implement that.

Oh, OK.  As long as I know what TODO item to mark as done when we are
finished.  :-)

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073