pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: kou@clear-code.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14160: DROP ACCESS METHOD IF EXISTS isn't implemented
Date: Fri, 27 May 2016 07:04:33 +0000
Message-ID: <20160527070433.19424.81712@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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)

view thread (3+ messages)  latest in thread

Message-ID: <20160527070433.19424.81712@wrigleys.postgresql.org>
Permalink:  ../20160527070433.19424.81712@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160527070433.19424.81712@wrigleys.postgresql.org

 ·  · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: kou@clear-code.com
  Subject: Re: BUG #14160: DROP ACCESS METHOD IF EXISTS isn't implemented
  In-Reply-To: <20160527070433.19424.81712@wrigleys.postgresql.org>
  References: <20160527070433.19424.81712@wrigleys.postgresql.org>

* 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