pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14160: DROP ACCESS METHOD IF EXISTS isn't implemented
3+ messages / 3 participants
[nested] [flat]

* BUG #14160: DROP ACCESS METHOD IF EXISTS isn't implemented
@ 2016-05-27 07:04  kou@clear-code.com
  0 siblings, 2 replies; 3+ messages in thread

From: kou@clear-code.com @ 2016-05-27 07:04 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14160
Logged by:          Kouhei Sutou
Email address:      kou@clear-code.com
PostgreSQL version: 9.6beta1
Operating system:   Debian GNU/Linux sid
Description:        

"DROP ACCESS METHOD IF EXISTS" against nonexistent access method returns an
error:

----
postgres=# DROP ACCESS METHOD IF EXISTS nonexistent;
ERROR:  unexpected object type (0)
----

Here is an implementation:

----
inline patch 1: src/backend/commands/dropcmds.c (+0/-0 lines) download 0001-Implement-DROP-ACCESS-METHOD-IF-EXISTS-against.patchFrom a7b32f3ab3fed3a5334d7ca7d8e31edc474dc26e Mon Sep 17 00:00:00 2001 From: Kouhei Sutou <kou@clear-code.com> Date: Fri, 27 May 2016 16:03:11 +0900 Subject: [PATCH] Implement DROP ACCESS METHOD IF EXISTS against nonexistent access method --- src/backend/commands/dropcmds.c | 4 ++++ src/test/regress/expected/drop_if_exists.out | 5 +++++ src/test/regress/sql/drop_if_exists.sql | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmds.c index 522027a..d9f7861 100644 --- a/src/backend/commands/dropcmds.c +++ b/src/backend/commands/dropcmds.c @@ -437,6 +437,10 @@ does_not_exist_skipping(ObjectType objtype, List
*objname, List *objargs) } } break; + case OBJECT_ACCESS_METHOD: + msg = gettext_noop("access method \"%s\" does not exist, skipping"); + name = NameListToString(objname); + break; default: elog(ERROR, "unexpected object type (%d)", (int) objtype); break; diff --git a/src/test/regress/expected/drop_if_exists.out b/src/test/regress/expected/drop_if_exists.out index 6910b62..9cda96b 100644
inline patch 2: src/test/regress/expected/drop_if_exists.out (+0/-0 lines) download inline-2.patch--- a/src/test/regress/expected/drop_if_exists.out +++ b/src/test/regress/expected/drop_if_exists.out @@ -227,6 +227,11 @@ DROP OPERATOR FAMILY test_operator_family USING
no_such_am; ERROR: access method "no_such_am" does not exist DROP OPERATOR FAMILY IF EXISTS test_operator_family USING no_such_am; ERROR: access method "no_such_am" does not exist +-- access method +DROP ACCESS METHOD no_such_am; +ERROR: access method "no_such_am" does not exist +DROP ACCESS METHOD IF EXISTS no_such_am; +NOTICE: access method "no_such_am" does not exist, skipping -- drop the table DROP TABLE IF EXISTS test_exists; DROP TABLE test_exists; diff --git a/src/test/regress/sql/drop_if_exists.sql b/src/test/regress/sql/drop_if_exists.sql index 03547cc..4ff0450 100644
inline patch 3: src/test/regress/sql/drop_if_exists.sql (+0/-0 lines) download inline-3.patch--- a/src/test/regress/sql/drop_if_exists.sql +++ b/src/test/regress/sql/drop_if_exists.sql @@ -227,6 +227,10 @@ DROP OPERATOR FAMILY IF EXISTS test_operator_family
USING btree; DROP OPERATOR FAMILY test_operator_family USING no_such_am; DROP OPERATOR FAMILY IF EXISTS test_operator_family USING no_such_am; +-- access method +DROP ACCESS METHOD no_such_am; +DROP ACCESS METHOD IF EXISTS no_such_am; + -- drop the table DROP TABLE IF EXISTS test_exists; -- 2.8.1 ---- -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs Patches: download all (3 files, .tar.gz) ^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: BUG #14160: DROP ACCESS METHOD IF EXISTS isn't implemented
@ 2016-05-27 07:48  Michael Paquier <michael.paquier@gmail.com>
  parent: kou@clear-code.com
  1 sibling, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2016-05-27 07:48 UTC (permalink / raw)
  To: kou@clear-code.com; +Cc: pgsql-bugs

On Fri, May 27, 2016 at 4:04 PM,  <kou@clear-code.com> wrote:
> "DROP ACCESS METHOD IF EXISTS" against nonexistent access method returns an
> error:
>
> ----
> postgres=# DROP ACCESS METHOD IF EXISTS nonexistent;
> ERROR:  unexpected object type (0)
> ----

Good catch. The documents are stating that it is implemented though
that's not the case.
-- 
Michael


-- 
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 #14160: DROP ACCESS METHOD IF EXISTS isn't implemented
@ 2016-05-27 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  parent: kou@clear-code.com
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2016-05-27 15:04 UTC (permalink / raw)
  To: kou@clear-code.com; +Cc: pgsql-bugs

kou@clear-code.com writes:
> "DROP ACCESS METHOD IF EXISTS" against nonexistent access method returns an
> error:

Pushed, thanks!

			regards, tom lane


-- 
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:[~2016-05-27 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27 07:04 BUG #14160: DROP ACCESS METHOD IF EXISTS isn't implemented kou@clear-code.com
2016-05-27 07:48 ` Michael Paquier <michael.paquier@gmail.com>
2016-05-27 15:04 ` Tom Lane <tgl@sss.pgh.pa.us>

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