PostgreSQL directory doesn't appear where database says it is - postgresql

I am newbie in postgres. I am trying change the access type to my local database. I read many blogs about how to do this but when I tried locate the PostgresQL folder, it doesn't appear in any place. I entered to database and write SHOW hba_file then I got the folder path. But, when I am looking for it from bash, the folder doesn't exist. I am not sure what is happening here. I am on Mac Catalina 10.15.6. I am using Iterm2 with ZSH.

Related

(Postgres) ERROR: could not access file "$libdir/uuid-ossp": No such file or directory

I installed curl on my machine today by running brew install curl, and it installed curl but also ended up updating a bunch of other packages, including my postgres (I'm using postgresql12)
I end up running any insert statement (which will insert a primary key automatically), and I get this error:
[58P01] ERROR: could not access file "$libdir/uuid-ossp": No such file or directory
When I run select * from pg_extension, I see that I have uuid-ossp installed as an extension, so I do not know why it is not able to find this.
I am using MacOS
This isn't an answer to my question because I went to a last resort, but I ended up just reinstalling postgres: https://bitadj.medium.com/completely-uninstall-and-reinstall-psql-on-osx-551390904b86
I would still like to hear other answers on the matter, as I would not recommend my answer unless absolutely necessary

Postgres: PostGIS extension in a separate path

The Linux machine I use has SuSE 12.1 with Postgres 9.4 installed (as root). I was able to compile and install the PostGIS 2.5 extension in a user area. Under this installation, I see, among other things, contrib folder, some sql files and .so files etc.
I can launch Postgres using my personal user. How can I let Postgres know to refer to this directory where all the PostGIS extension related files/objects are available?
When I try creating the extension, I get the following error:
ERROR: could not open extension control file "/usr/share/postgresql94/extension/postgis.control": No such file or directory
Of course, some error is expected as Postgres doesn't know about my PostGIS installation. But the latter does not have such a file, postgis.control.
I am guessing the solution is to ensure Postgres can see the .so files (may be set LD_LIBRARY_PATH?) or create a postgis.control file with all the relevant details etc.
Any assistance including simply pointing to documentation will be appreciated.
I see a few similar questions but no one seems to address my issue of the extension - PostGIS - in a separate directory. They assume root access.
Like every extension, PostGIS has to be installed in the PostgreSQL extension subdirectory (under share).
When PostGIS is configured, it looks for pg_config on the PATH, or you can explicitly specify the --with-pgconfig option to configure.
Once you have built PostGIS, make install will automatically put all files in the proper place.
You are not very specific how you built PostGIS, but you must have strayed from the correct path somewhere. If you share some details, we might be able to figure out what went wrong.
Re-reading your question I get the impression that you installed PostGIS somewhere outside the PostgreSQL software directory because you lack the necessary root privilege. That simply won't work, and there is no workaround.
You'd have to install PostgreSQL somewhere where you have write access.

Does Postgresql work after copied to other directory on windows?

I'm new to Postgresql and am going to install on A directory for my Application.
After building a package including the Application and Postgresql, I should deliver it to other user(by Installer but Postresql is not embedded).
I was wondering if it is okay for me to just copy Postgresql to other directory without any consideration of registry or environment variables on Windows.
Does it work by copying the all of directories to other directory or server?
If you stop the running PostgreSQL service, and you preserve file permissions when copying/moving, and the destination is also a NTFS filesystem, it will work. But you'll have to adjust the service definition or create a new one to start from the new location; PostgreSQL won't know where the data directory is until you tell it.
However.
You should simply initdb PostgreSQL where it needs to be in the first place. There's no need to copy or move the data directory. Ask the user where they want it to be put and then put it there from the start.
I strongly recommend that you bundle PostgreSQL binaries in your installer rather than having the user run a PostgreSQL installer first. Then have your app initdb its own private PostgreSQL data directory for its use.
See Installation of postgresql with NSIS (it doesn't matter if you're not using NSIS, the principles are the same).

Installing PG_SIMILARITY on PostgreSQL, Windows

I am trying to install the pg_similarity extension for Windows PostgreSQL 9.1 x64.
I believe I have placed the necessary files into the /share/contrib directory and also the /share/extension directory as instructed in the documentation.
When running CREATE EXTENSION pg_similarity; I get this error:
ERROR: could not access file "$libdir/pg_similarity": No such file or directory
I believe this is because I do not have the pg_similarity.dll file in the /lib/ directory.
The instructions at https://github.com/eulerto/pg_similarity (for Windows) say to generate that file by "executing pg_config --libdir" which obviously does not work in and of itself. I assume other steps are implied or left out.
Could someone please explain how to complete that part of the installation and/or generate the needed .dll file and provide it? The installation instructions for Windows are not very detailed.
The only other part of the instructions I did not follow was:
"Edit contrib/Makefile and add pg_similarity to SUBDIRS variable;" however that file already contains a line subdir = contrib/pg_similarity which sounds as though that has already been set. If not I certainly don't know what needs to be changed and that's all there is to the explanation of what to change.

"existing data directory" error when installing PostreSQL for mac

Hey guys i have been trying to download it from the below link
http://www.enterprisedb.com/products-services-training/pgdownload
But once i download it, and try to run the set up it is giving me an error saying
An existing data directory has been selected but its neither empty, or a recognizable date directory,I tried changing the path on which it has to be downloaded it is not letting me do so
I'd recommend trying a package manager such as brew. Once you have it installed simply:
brew install postgres
Disclaimer: I have no experience with Postgres on Mac (or with a Mac at all).
The installer will create a directory where PostgreSQL stores all the database data and information. Without this so called "data directory" PostgreSQL does not work.
This data directory has nothing to do with your download directory.
Apparently you are pointing the installer to a directory that already exists and contains some data (not necessarily Postgres related data).
When being prompted for the "data directory" during installation you have to select an empty directory.
I don't know if the selection dialog of the installer will let you create a new directory, so you might want to create that directory manually before starting the installer.
Recently had this issue after attempting a reinstall of PostgreSQL on macOS 11.6
Removing the contents of the /Library/PostgreSQL/14/data directory seemed to resolve the issue and was able to successfully reinstall