pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera from 2ndQuadrant <alvherre@postgresql.org>
To: Nikolay Shaplov <dhyan@nataraj.su>
Cc: pgsql-hackers@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH][PROPOSAL] Add enum releation option type
Date: Thu, 5 Sep 2019 11:42:27 -0400
Message-ID: <20190905154227.GA5287@alvherre.pgsql> (raw)
In-Reply-To: <15941756.bfKRYTai5T@x200m>

After looking closer once again, I don't like this patch.

I think the FOOBAR_ENUM_DEF defines serve no purpose, other than
source-code placement next to the enum value definitions.  I think for
example check_option, living in reloptions.c, should look like this:

	{
		{
			"check_option",
				"View has WITH CHECK OPTION defined (local or cascaded).",
				RELOPT_KIND_VIEW,
				AccessExclusiveLock
		},
		{
			{ "local", VIEW_OPTION_CHECK_OPTION_LOCAL },
			{ "cascaded", VIEW_OPTION_CHECK_OPTION_CASCADED },
			{ NULL }
		},
		"Valid values are \"local\" and \"cascaded\"."
	},

Note the relopt_enum is pretty much the same you have, except we also
have a const char *valid_values_errdetail; and the ugly #define no
longer exists but instead we put it in enumRelOpts.

rel.h ends up like this:

/*
 * Values for ViewOptions->check_option.
 */
typedef enum
{
	VIEWOPTIONS_CHECK_OPTION_NOTSET,
	VIEWOPTIONS_CHECK_OPTION_LOCAL,
	VIEWOPTIONS_CHECK_OPTION_CASCADED
} ViewOpts_CheckOptionValues;

/*
 * ViewOptions
 *		Contents of rd_options for views
 */
typedef struct ViewOptions
{
	int32		vl_len_;		/* varlena header (do not touch directly!) */
	bool		security_barrier;
	ViewOpts_CheckOptionValues check_option;
} ViewOptions;

I'm marking this Waiting on Author.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (40+ messages)  latest in thread

Message-ID: <20190905154227.GA5287@alvherre.pgsql>
Permalink:  ../20190905154227.GA5287@alvherre.pgsql/
Also on:    postgresql.org/message-id/20190905154227.GA5287@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@postgresql.org, dhyan@nataraj.su, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, n.gluhov@postgrespro.ru
  Subject: Re: [PATCH][PROPOSAL] Add enum releation option type
  In-Reply-To: <20190905154227.GA5287@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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