Thread: Syntax supplements for SET options
I found a couple of incomplete syntax when I was adjusting psql automatic tab completion for HEAD. 1. We cannot specify tablespace options on "CREATE TABLESPACE" though "ALTER TABLESPACE" supports generic options by SET(...). 2. Should we still support "ALTER COLUMN SET STATISTICS" though we can set generic options with "ALTER COLUMN SET (...)"? 3. We cannot specify column options on "CREATE TABLE" though "ALTER TABLE ALTER COLUMN SET ..." supports it. Which item should we fix? I think the 1st is simple to be fixed if needed. Since the 2nd was added during alpha, we could revert it if needed. The 3rd is relatively hard to fix because we need to adjust the syntax all of the kinds of columns options - STATISTICS, STORAGE, and generic options - without keywords confliction. Regards, --- Takahiro Itagaki NTT Open Source Software Center
On Sun, Jan 24, 2010 at 9:16 PM, Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp> wrote: > I found a couple of incomplete syntax when I was adjusting psql > automatic tab completion for HEAD. So, I'm slightly confused about whether you want to fix tab completion or behavior, but... > 1. We cannot specify tablespace options on "CREATE TABLESPACE" > though "ALTER TABLESPACE" supports generic options by SET (...). I'm not super excited about adding tablespace options as part of CREATE TABLESPACE support, but I certainly don't object if you want to have a go at it. With respect to tab completion, ALTER TABLESPACE x currently completes with only "OWNER TO" or "RENAME TO"; we need to add "SET" to that list. My bad. > 2. Should we still support "ALTER COLUMN SET STATISTICS" > though we can set generic options with "ALTER COLUMN SET (...)" ? I don't think we can change this because "ALTER COLUMN SET STATISTICS" is not new in 8.5. We added (and then removed) "ALTER COLUMN SET STATISTICS DISTINCT", but that's not the same thing. What we COULD do is add a column option called statistics_target and then make ALTER COLUMN SET STATISTICS set that option under the hood, removing attstattarget. We could then document that ALTER COLUMN SET STATISTICS is deprecated and may be removed in a future release, but we won't actually be able to remove it for a long time. On tab completion: if you enter "ALTER TABLE x ALTER COLUMN y SET STATISTICS" and then hit tab twice, it adds "TO DEFAULT", which isn't legal syntax. > 3. We cannot specify column options on "CREATE TABLE" > though "ALTER TABLE ALTER COLUMN SET ..." supports it. As with tablespace options, these are more likely to be things that you set on an existing table once you discover that something isn't working quite right than they are to be things that you want to do when initially creating the table. There's also the issue of exactly what the syntax should be. But I'm not opposed to it. ...Robert
Robert Haas <robertmhaas@gmail.com> writes: > I don't think we can change this because "ALTER COLUMN SET STATISTICS" > is not new in 8.5. We added (and then removed) "ALTER COLUMN SET > STATISTICS DISTINCT", but that's not the same thing. > What we COULD do is add a column option called statistics_target and > then make ALTER COLUMN SET STATISTICS set that option under the hood, > removing attstattarget. We could then document that ALTER COLUMN SET > STATISTICS is deprecated and may be removed in a future release, but > we won't actually be able to remove it for a long time. Approximately forever, in fact, because that type of command is emitted by pg_dump. Removing it would break old dumps, and we don't do that. > As with tablespace options, these are more likely to be things that > you set on an existing table once you discover that something isn't > working quite right than they are to be things that you want to do > when initially creating the table. There's also the issue of exactly > what the syntax should be. But I'm not opposed to it. All of this sounds like too-late-for-9.0 material to me. regards, tom lane
Robert Haas <robertmhaas@gmail.com> wrote: > With respect to tab completion, ALTER TABLESPACE x currently completes > with only "OWNER TO" or "RENAME TO"; we need to add "SET" to that > list. My bad. Ok, I'll go for it. I see non-tab-completion parts are too late for 9.0. Regards, --- Takahiro Itagaki NTT Open Source Software Center