tembo-io / pg_later

Execute SQL now and get the results later.
PostgreSQL License
354 stars 10 forks source link

Installation Issue #31

Closed nidhin077 closed 1 year ago

nidhin077 commented 1 year ago

Hi,

Initially, we attempted to install pg_later on the Ubuntu 20.04 version using the root account, but I encountered an issue at the stage of

cargo pgrx run pg13

initdb: error: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

I then attempted the same using a normal user and received a permission problem.

Error: 
   0: failed writing `/home/citrus/pg_later/pg_later.control` to `/usr/share/postgresql/13/extension/pg_later.control`
   1: Permission denied (os error 13)

Location:
   /home/citrus/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pgrx-0.9.8/src/command/install.rs:223

Would someone kindly help me to address this problem?

ChuckHend commented 1 year ago

Hello @nidhin077 - which users owns the directory /usr/share/postgresql/13/extension/? Often that is owned by postgres and it is the only user allowed to write, but could depend on how you are running postgres.

nidhin077 commented 1 year ago

@ChuckHend We attempted the same using a Postgres user and changed the folder permissions, but the permission error persisted.


Error: 
   0: failed copying `/usr/share/postgresql/13/pg_later/target/release/libpg_later.so` to `/usr/lib/postgresql/13/lib/pg_later.so`
   1: Permission denied (os error 13)

Location:
   /var/lib/postgresql/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pgrx-0.9.8/src/command/install.rs:227

Please take a look and let me know how to proceed the same.

ChuckHend commented 1 year ago

Could you try getting it to run on a fresh project? cargo pgrx new ,cargo pgrx init then cargo pgrx run pg13? It feels like there is an OS level configuring that you'll need to figure out, but we can try to rule pg_later first.

nidhin077 commented 1 year ago

@ChuckHend I'm sorry, I misunderstood what you were trying to say. We're attempting to add a pg_later extension to my existing Postgres-13 database. When I tried the aforementioned procedure, it created a new Postgres instance. however, I want to preserve my current Postgres13 instance and install the same on it.

Please let me know how to setup the same.

ChuckHend commented 1 year ago

cargo pgrx run installs the extension into a dev instance of postgres that is managed by pgrx (the framework we used to build pg_later). We need to provide pgrx with the path to the pg_config that we want to use during install so that it can find the appropriate sharedir, pkglibdir, etc.

Try this (you can change out $(which pg_config) with the path to your pg_config binary.

cargo pgrx install --pg-config $(which pg_config)
rinshadka commented 1 year ago

cargo pgrx run installs the extension into a dev instance of postgres that is managed by pgrx (the framework we used to build pg_later). We need to provide pgrx with the path to the pg_config that we want to use during install so that it can find the appropriate sharedir, pkglibdir, etc.

Try this (you can change out $(which pg_config) with the path to your pg_config binary.

cargo pgrx install --pg-config $(which pg_config)

Thanks @ChuckHend, This worked.