zubkov-andrei / pg_profile

Postgres historic workload reports
Other
228 stars 33 forks source link

cannot create pg_profile extension #6

Closed TamarNR closed 3 years ago

TamarNR commented 4 years ago

Hi, I am using postgreSql 11. Downloaded the pg_profile-master.zip, unzipped it.

Changed the postgresql.conf file as required, and copied pg_profile as explained: `# cp pg_profile pg_config --sharedir/extension `

When tried to create the pg_profile extension, got this error: ERROR: could not open extension control file "/usr/share/postgresql/11/extension/pg_profile.control": No such file or directory

Following an advice, I removed this line from the Makefile under my pg_profile-master directory: #PG_CONFIG = /usr/local/pgsql/bin/pg_config and ran this command:

# make USE_PGXS=y ins
/bin/mkdir -p '/usr/share/postgresql/11/extension'
/bin/mkdir -p '/usr/share/postgresql/11/extension'
/usr/bin/install -c -m 644 .//pg_profile.control '/usr/share/postgresql/11/extension/'     

but when trying to create the extension got this error:

# CREATE EXTENSION pg_profile;
ERROR:  syntax error at or near "
INE 1: CREATE EXTENSION pg_profile;
        ^

Tried to Change the Makefile to point to the correct location of pg_config: PG_CONFIG = /usr/bin/pg_config and ran "make USE_PGXS=y ins" again, but the create extension failed with the same error.

Am i missing something?

zubkov-andrei commented 4 years ago

Hi,

First of all, why not to use release package [https://github.com/zubkov-andrei/pg_profile/releases/tag/0.1.1](release 0.1.1)?. This is the most easy way - you won't need to make an extension. Also, update scripts will be available only between releases. Making extension is only needed for developing/debugging.

About described error... I've tried to reproduce an issue on pg12. Your case is seems to be common for all versions. I've pointed PG_CONFIG variable to my pg_config file:

$ grep PG_CONFIG Makefile
PG_CONFIG = /usr/local/pgsql/bin/pg_config

Than I've ran make command:

$ sudo make USE_PGXS=y install
echo '\echo Use "CREATE EXTENSION pg_profile" to load this file. \quit' > pg_profile--0.1.1.sql
cat schema.sql internal.sql baseline.sql node.sql snapshot.sql dbstat.sql statementstat_dbagg.sql clusterstat.sql tablespacestat.sql tablestat.sql indexstat.sql dead_mods_ix_unused.sql top_io_stat.sql functionstat.sql settings.sql statements_checks.sql statementstat.sql report.sql reportdiff.sql >> pg_profile--0.1.1.sql
sed -e 's/{version}/0.1.1/' pg_profile.control.tpl > pg_profile.control
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/install -c -m 644 .//pg_profile.control '/usr/local/pgsql/share/extension/'
/bin/install -c -m 644  pg_profile--0.1.1.sql pg_profile.control '/usr/local/pgsql/share/extension/'

Create extension:

postgres=# create extension pg_profile schema profile;
CREATE EXTENSION

So, make sure you have both _pgprofile--0.1.1.sql and _pgprofile.control in your extension directory after you run make install:

$ ls /usr/local/pgsql/share/extension/pg_profile*
/usr/local/pgsql/share/extension/pg_profile--0.1.1.sql
/usr/local/pgsql/share/extension/pg_profile.control

Are you running CREATE EXTENSION pg_profile command manually from psql or it is a part of some script? Is there any log records in the postgresql server logs?

zubkov-andrei commented 3 years ago

Closed due to inactivity