3

My basic extension code is at location -> /Users/spartacus/Desktop/GSoC/CODE/my_extension

  • my_extension.control
# my_extension.control
comment = 'Minimal Viable Product'
default_version = '1.0'
relocatable = true

# Installation script for version 1.0
# 1.0
# my_extension--1.0.sql
  • my_extension--1.0.sql
-- my_extension--1.0.sql

-- Create necessary objects for version 1.0
CREATE TABLE my_table (
  id SERIAL PRIMARY KEY,
  name VARCHAR(100) NOT NULL
);

CREATE FUNCTION my_function() RETURNS void AS $$
BEGIN
  -- Function logic goes here
END;
  • MakeFile
DATA = my_extension--1.0.sql

PG_CONFIG  ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

-- cd command to navigate to the directory where your extension files are located. After connecting to that location, executing the make command throws this error:

make: Nothing to be done for 'all'

-- After executing make install:

  • /bin/sh /opt/homebrew/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/opt/homebrew/share/postgresql/contrib'
  • /usr/bin/install -c -m 644 .//my_extension--1.0.sql '/opt/homebrew/share/postgresql/contrib/'

-- Running psql; Then after executing CREATE EXTENSION my_extension; This error occurs:

  • ERROR: extension "my_extension" is not available
  • DETAIL: Could not open extension control file "/Applications/Postgres.app/Contents/Versions/15/share/postgresql/extension/my_extension.control": No such file or directory.
  • HINT: The extension must first be installed on the system where PostgreSQL is running.

How to solve this issue?

2
  • Your extension does not need a library so just put .sql and .controlfile into your extension folder Commented Jun 25, 2023 at 16:52
  • I need to use a Makefile, it's a part of the project I am currently pursuing. I have already made a simple extension with a .sql and a .control file for them I copied the files to the directories. But I need to use the makefile to i install the control file remotely Commented Jun 25, 2023 at 17:43

1 Answer 1

2

Your Makefile is lacking the entry

EXTENSION = my_extension

That's why make install doesn't copy the *.control file, and that's why CREATE EXTENSION fails.

2
  • Thanks a lot. Just a doubt, what does the make: Nothing to be done for 'all' mean. Is it an error? Commented Jun 26, 2023 at 7:42
  • 1
    That you have no MODULE or other binary to build. You can go directly to the make install step. Commented Jun 26, 2023 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.