Why shouldn't PostGIS be installed in the PostgreSQL database "postgres"? - database

The PostGIS installation documentation reads:
PostGIS is an optional extension that must be enabled in each database you want to use it in before you can use it. Installing the software is just the first step. DO NOT INSTALL it in the database called postgres.
We're running PostgreSQL in Docker and only need one database, so we've been using the default database, postgres. My first inclination was to install PostGIS there, but the documentation seems pretty clear that we shouldn't be doing that.
Is there a reason for PostGIS not to be installed on the default database, or is this note meant to deter people from accidentally installing PostGIS in the postgres database when their data is in the foobar database?
Thanks!

There is no danger in installing PostGIS into the postgres database. The note is just so users don't confuse themselves, as you suspected.

Related

Upgrade version of Postgres

I wanted to ask if I understand correctly the upgrade of Postgres. Currently version 9.6 is installed on the server. I plan to raise version 12. Is the easiest solution to do a dumpall (because there are several databases on this server and I do not want to do only the whole separately) then remove the old version of postgres and install a newer one? I wanted to make sure because I found some examples. Should I still do something about this flow? I am asking for guidance.
Best is to install the old and the new version of PostgreSQL side by side.
Then you can either use pg_dumpall (from the newer version!) and psql to dump and restore, or you can use pg_upgrade.
The documentation covers that in detail.

Symmetricds support spatialite database?

How can I configure the symmetric db engine to replicate a SpatiaLite database ?
If there are no way what's the steps to add a new platform to symmetric db?
No, there’s no support
Fork the source code from developer’s repository, find a support, try to replicate it and after testing submit a patch back
Have tried using the SQL Lite dialect? It appears the SpatiaLite database is just an extension to SQL Lite for spatial data. SymmetricDS works with Oracle and Postgres spatial data out of the box. So treating it as a SQL Lite node may be sufficient. If there are additional libraries that need added you can put them in the lib folder of SymmetricDS and restart.

PostgreSql 9.3 initdb

I am trying to log an application using postgresql and I want to use a database in a place other then where the installation creates it. I have done this several times in the past, but I guess postgresql has changed. The message told me I had to install some clustering solution, all I want to do is change to another database solution.
Is there a way to initialize a database in postgresql other then initdb and postgres-xc.
Also, pg_ctl is now only available on postgres-xs. I don't need a clustering solution, I just need to move the database location.

PostgreSQL moving database with functions

I have strange problem.
I tried to move database from one server to another using pgAdmin III.
Database was created on server with PostgreSQL 8.4.9 and I wanted to move it on second server with PostgreSQL 8.2.11.
To do It, I used "backup" option and saved file, after that I used "restore" option on new database. Tables are loaded but there aren't any functions in new database.
Maybe it is because of different postgreSQL versions?
Does anyone know the reason? Any solution?
If the functions aren't around, double-check that plpgsql is available as a language. It's available by default nowadays, but making it available used to require a create language statement.
That said, I'd echo the comments: you really should be upgrading to a 9.x Postgres version that is still supported, rather than downgrading from an unsupported version to one that is even older.
I'd recommend to do it via pg_dump from an interactive session and export the complete database to one ore more sql files. There you can use the -s switch to have only the schema which should include created functions. Having this SQL file, you can also easier backport your changes or debug if something not applying to the old fallow.

MariaDB compare database schemas

We are multiple devs working on a project with MariaDb backend.
We would like to have revisions for our db schema changes & put this in source control.
Is there a way/tool to compare MariaDb database schemas & script these changes?
I know DbForge offers support for MariaDb, but Im looking for a free alternative to this tool.
Thanks
Make it simple. Dump schema with mysqldump tool(if I remember currectly, MariaDB has similar utils names) and save it in git/hg/svn.
mysqldump -u root -p --no-data dbname > schema.sql
It will create SQL query to create table, which will contain same format and every field will be on new line, so you can easily compare and make diffs in any tool to control versions.
There could be only one problem: commas. For example, if you have added new field, it will be added last, but previous will be changed - it will contain comma in the end at schema.sql, but it is common problem with any version-control tool, anyway you can find out more info by using diffs.
to compare the schema of two MariaDB databases I'd suggest to use:
TiCodeX SQL Schema Compare (https://www.ticodex.com).
It also gives you the migration script to update the destination database in case there are differences.
It's a nice tools that runs in Windows, Linux and Mac and can compare the schema of MS-SQL, MySQL, MariaDB and PostgreSQL database. Easy to use and effective. It may help you.
It's worth to mention that is the only tool I've found that also works nicely on Linux and MacOS.

Resources