pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
can you give me a sql example to explain this?
2+ messages / 2 participants
[nested] [flat]

* can you give me a sql example to explain this?
@ 2022-10-25 14:54  jacktby@gmail.com <jacktby@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: jacktby@gmail.com @ 2022-10-25 14:54 UTC (permalink / raw)
  To: pgsql-general <pgsql-general@lists.postgresql.org>

/*
 * In a "leaf" node representing a VALUES list, the above fields are all
 * null, and instead this field is set.  Note that the elements of the
 * sublists are just expressions, without ResTarget decoration. Also note
 * that a list element can be DEFAULT (represented as a SetToDefault
 * node), regardless of the context of the VALUES list. It's up to parse
 * analysis to reject that where not valid.
 */
List    *valuesLists; /* untransformed list of expression lists */

I need to understand what this is used for?


jacktby@gmail.com


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: can you give me a sql example to explain this?
@ 2022-10-25 15:18  David G. Johnston <david.g.johnston@gmail.com>
  parent: jacktby@gmail.com <jacktby@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2022-10-25 15:18 UTC (permalink / raw)
  To: jacktby@gmail.com <jacktby@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On Tue, Oct 25, 2022 at 7:54 AM jacktby@gmail.com <jacktby@gmail.com> wrote:

> /*
>  * In a "leaf" node representing a VALUES list, the above fields are all
>  * null, and instead this field is set.  Note that the elements of the
>  * sublists are just expressions, without ResTarget decoration. Also note
>  * that a list element can be DEFAULT (represented as a SetToDefault
>  * node), regardless of the context of the VALUES list. It's up to parse
>  * analysis to reject that where not valid.
>  */
> List    *valuesLists; /* untransformed list of expression lists */
>
> I need to understand what this is used for?
>

That's a fairly broad question...does this help?

In the SQL command:

VALUES ('one', 'two', 1+2, DEFAULT)

The valuesLists List will effectively contain three elements, {'one'},
{'two'}, {1+2}, and {DEFAULT}.

Though if it contains DEFAULT and the VALUES is not part of an INSERT an
error should eventually occur during parse analysis since a plain VALUES
command has no context from which to retrieve a default.

David J.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-10-25 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 14:54 can you give me a sql example to explain this? jacktby@gmail.com <jacktby@gmail.com>
2022-10-25 15:18 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox