pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jacktby@gmail.com <jacktby@gmail.com>
To: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Re: access method xxx does not exist
Date: Sat, 29 Oct 2022 20:15:54 +0800
Message-ID: <2022102920155312722925@gmail.com> (raw)
In-Reply-To: <2022102919192714253321@gmail.com>
References: <2022102919192714253321@gmail.com>
	<20221029120024.6olwz2msln2g6oxf@hjp.at>

On 2022-10-29 19:19:28 +0800, jacktby@gmail.com wrote:
> I'm trying to add a new index, but when I finish it, I use “ create index
> xxx_index on t1 using xxx(a); ”,it gives me access method "my_index" does not
> exist
> And I don't know where this message is from, can you grve me its position?

See https://www.postgresql.org/docs/current/sql-createindex.html

The syntax for CREATE INDEX is 

CREATE INDEX ON table_name [ USING method ] ( column_name ... )

You use USING to specify the method (e.g. btree or gin), not the table
and/or columns. The columns (or expressions come in parentheses after
that.

So if you wanted an index on column a of table t1 you would simply
write:

CREATE INDEX ON t1 (a);

Or if you have a function xxx and you want a function based index on
xxx(a) of that table:

CREATE INDEX ON t1 (xxx(a));

(You can specify the name of the index, but why would you?)

> I do like this. I add oid in pg_am.dat and pg_proc.dat for my index.
> And I add codes in contrib and backend/access/myindex_name, is there
> any other places I need to add some infos?

What? Why are you doing these things?

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"


view thread (7+ messages)  latest in thread

Message-ID: <2022102920155312722925@gmail.com>
Permalink:  ../2022102920155312722925@gmail.com/
Also on:    postgresql.org/message-id/2022102920155312722925@gmail.com

 · 

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-general@postgresql.org
  Cc: jacktby@gmail.com, hjp-pgsql@hjp.at
  Subject: Re: access method xxx does not exist
  In-Reply-To: <2022102920155312722925@gmail.com>
  References: <2022102919192714253321@gmail.com> <20221029120024.6olwz2msln2g6oxf@hjp.at> <2022102920155312722925@gmail.com>

* 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