pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #12024: autocomplete doesn't work for ALTER CONSTRAINT
3+ messages / 3 participants
[nested] [flat]

* BUG #12024: autocomplete doesn't work for ALTER CONSTRAINT
@ 2014-11-21 15:19  lizenko79@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: lizenko79@gmail.com @ 2014-11-21 15:19 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      12024
Logged by:          Andrey Lizenko
Email address:      lizenko79@gmail.com
PostgreSQL version: 9.4beta2
Operating system:   Ubuntu LTS 12.04
Description:        

Its a very minor bug in psql client. 
Server and client version is 9.4 RC (cann't see rc, only beta in version
ашудв)

If I try to press "tab" to complete 
ALTER TABLE <some_table> ALTER CO...

only COLUMN hint is shown, CONSTRAINT is missing

Full command works fine.
postgres=# ALTER TABLE b ALTER CONSTRAINT "b_cons" DEFERRABLE INITIALLY
DEFERRED;
ALTER TABLE
  


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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

* Re: BUG #12024: autocomplete doesn't work for ALTER CONSTRAINT
@ 2014-11-26 05:54  Michael Paquier <michael.paquier@gmail.com>
  parent: lizenko79@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2014-11-26 05:54 UTC (permalink / raw)
  To: lizenko79@gmail.com; +Cc: pgsql-bugs

On Sat, Nov 22, 2014 at 12:19 AM, <lizenko79@gmail.com> wrote:

> If I try to press "tab" to complete
> ALTER TABLE <some_table> ALTER CO...
>
> only COLUMN hint is shown, CONSTRAINT is missing
>
Yes, indeed. Supporting ALTER TABLE <foo> ALTER CONSTRAINT has proved not
to be that complicated. Per se the patch attached. I haven't added the part
about deferred constraints but still that's an improvement as it can go up
to the constraint detection.
-- 
Michael

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

20141126_constraint_tabcompl.patch (text/x-patch, 1.7K) download From 667247fa4f8b543a59285584d7a0db78a0c2b7e6 Mon Sep 17 00:00:00 2001 From: Michael Paquier <michael@otacoo.com> Date: Wed, 26 Nov 2014 14:49:31 +0900 Subject: [PATCH] Enable tab-completion of ALTER TABLE <foo> ALTER CONSTRAINT Per bug report from Andrey Lizenko. --- src/bin/psql/tab-complete.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 278d395..6bd81b7 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1605,7 +1605,7 @@ psql_completion(const char *text, int start, int end) else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 && pg_strcasecmp(prev3_wd, "TABLE") == 0 && pg_strcasecmp(prev_wd, "ALTER") == 0) - COMPLETE_WITH_ATTR(prev2_wd, " UNION SELECT 'COLUMN'"); + COMPLETE_WITH_ATTR(prev2_wd, " UNION SELECT 'COLUMN' UNION SELECT 'CONSTRAINT'"); /* ALTER TABLE xxx RENAME */ else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 && @@ -1655,12 +1655,13 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH_ATTR(prev3_wd, ""); /* - * If we have ALTER TABLE <sth> DROP|RENAME|VALIDATE CONSTRAINT, provide - * list of constraints + * If we have ALTER TABLE <sth> ALTER|DROP|RENAME|VALIDATE CONSTRAINT, + * provide list of constraints */ else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 && pg_strcasecmp(prev4_wd, "TABLE") == 0 && - (pg_strcasecmp(prev2_wd, "DROP") == 0 || + (pg_strcasecmp(prev2_wd, "ALTER") == 0 || + pg_strcasecmp(prev2_wd, "DROP") == 0 || pg_strcasecmp(prev2_wd, "RENAME") == 0 || pg_strcasecmp(prev2_wd, "VALIDATE") == 0) && pg_strcasecmp(prev_wd, "CONSTRAINT") == 0) -- 2.1.3
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: BUG #12024: autocomplete doesn't work for ALTER CONSTRAINT
@ 2014-11-28 12:31  Fujii Masao <masao.fujii@gmail.com>
  parent: Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Fujii Masao @ 2014-11-28 12:31 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; +Cc: lizenko79@gmail.com; pgsql-bugs

On Wed, Nov 26, 2014 at 2:54 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Sat, Nov 22, 2014 at 12:19 AM, <lizenko79@gmail.com> wrote:
>>
>> If I try to press "tab" to complete
>> ALTER TABLE <some_table> ALTER CO...
>>
>> only COLUMN hint is shown, CONSTRAINT is missing
>
> Yes, indeed. Supporting ALTER TABLE <foo> ALTER CONSTRAINT has proved not to
> be that complicated. Per se the patch attached.

Pushed. Thanks!

Regards,

-- 
Fujii Masao


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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


end of thread, other threads:[~2014-11-28 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-11-21 15:19 BUG #12024: autocomplete doesn't work for ALTER CONSTRAINT lizenko79@gmail.com
2014-11-26 05:54 ` Michael Paquier <michael.paquier@gmail.com>
2014-11-28 12:31   ` Fujii Masao <masao.fujii@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