CREATE_ACCESS_METHOD(7pg14)
β¨ CREATE ACCESS METHOD β¨
okay so bestie, welcome to CREATE ACCESS METHOD(7) from the PostgreSQL 14.24 docs β this is the page where we learn how to literally invent a whole new access method, no cap π
πΈ NAME πΈ
CREATE ACCESS METHOD β define a new access method
π SYNOPSIS π
CREATE ACCESS METHOD name
TYPE access_method_type
HANDLER handler_function
π¦ DESCRIPTION π¦
So CREATE ACCESS METHOD creates a brand-new access method. That's the whole vibe β¨
The access method name must be unique within the database β no duplicates allowed, periodt. π«
And heads up: only superusers can define new access methods. So if you're not a superuser, this is not your main character moment, sorry not sorry π
π PARAMETERS π
nameβ the name of the access method to be created. Pick something cute but, like, unique.access_method_typeβ this clause says what kind of access method you're defining. Right now, onlyTABLEandINDEXare supported. That's it. That's the list. π«Άhandler_functionβ the name (possibly schema-qualified, iykyk) of a previously registered function that represents the access method. Real talk about the requirements:- the handler function must be declared to take a single argument of type
internal - its return type depends on the type of access method: for
TABLEaccess methods it must betable_am_handler, and forINDEXaccess methods it must beindex_am_handler - the C-level API that the handler function must implement also varies depending on the type of access method β the table access method API is described in Chapter 61, and the index access method API is described in Chapter 62 π
- the handler function must be declared to take a single argument of type
π₯ EXAMPLES π₯
Create an index access method heptree with handler function heptree_handler:
CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler;
slay. that's it. that's the example. π§
β COMPATIBILITY β
CREATE ACCESS METHOD is a PostgreSQL extension β so it's our thing, not a standard-SQL thing π
π SEE ALSO π
DROP ACCESS METHOD(DROP_ACCESS_METHOD(7))CREATE OPERATOR CLASS(CREATE_OPERATOR_CLASS(7))CREATE OPERATOR FAMILY(CREATE_OPERATOR_FAMILY(7))
and that's the page bestie!! go forth and make access methods π this was CREATE ACCESS METHOD(7) from PostgreSQL 14.24, dated 2026 β mwah, bye! ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms