How to set a timeout for liquibase changesets? - deployment

As the title says: how can I set a timeout for liquibase changesets? I need this to ensure that an oversight in a changeset cannot suddenly bring the production environment to a halt.

You can set timeout at jdbc-driver level using property (for example, see Setting Network Timeout for JDBC connection) and pass it using -D variable or with property-file to liquibase.

Related

On Heroku Postgres, how to change full-text search dictionary?

I'm wanting to change the default_text_search_config of my "Hobby Basic Heroku Postgres" database. After running
heroku pg:psql and
\dF,
I can see that Heroku has a preset stop dictionary that I want - Russian (pg_catalog.russian), so there is no need to create a new dictionary (although I see many questions about this as well).
According to the postgres docs, one can change this by altering the postgresql.conf, which is not applicable in this case, or by setting it for an individual session. I've tried setting it through the CLI with
SET default_text_search_config = 'pg_catalog.russian';
However, as soon as I exit the CLI, it reverts to the initial pg_catalog.english.
I'm using Prisma, so I've tried applying a migration of this as well, thinking that the issue was the session not persisting after I closed the CLI. This also was not successful.
Is there a way to do this?
It is also possible to set the default at the database level:
If you are using the same text search configuration for the entire cluster you can use the value in postgresql.conf. To use different configurations throughout the cluster but the same configuration within any one database, use ALTER DATABASE ... SET. Otherwise, you can set default_text_search_config in each session.
Assuming your database is called abcdefg, try the following:
ALTER DATABASE abcdefg SET default_text_search_config TO 'pg_catalog.russian';
I suspect this will work on Heroku's offering, but have not tried it.

PostgreSQL idle_in_transaction_session_timeout seems to have no effect

I'm working with a PostgreSQL server version 10.5 (can't upgrade it at the moment) running in Docker. XL Deploy is connected to it and I upload a new archive that is 232MB. I get the error FATAL: terminating connection due to idle-in-transaction timeout.
In the config, I saw that idle_in_transaction_session_timeout was set to 11000ms. I updated the value to 600000ms and reload the configuration. I see the message LOG: parameter "idle_in_transaction_session_timeout" changed to "600000" in the logs, so I know the setting has taken.
However, when I upload the archive again, I still get the same FATAL timeout message. It's as if the setting is having no effect.
As it turns out, the issue was in Postgres, but not in the config file. It seems you can update the value of idle_in_transaction_session_timeout at various levels. In my case, it was at the ROLE level. Issuing this SQL statement fixed the timeout.
ALTER ROLE role_abc SET idle_in_transaction_session_timeout = '10min';

Postgres DB suddenly logging all mod statements

We have a PostgreSQL DB on Heroku, without warning a few days ago it started logging all data changes as if the log_statement setting was set to mod which is having a massive impact on performance when we do our nightly batch updates.
I've checked the settings in the DB via the pg_settings view and using the Heroku CLI and it very clearly says the the log_statement setting is set to ddl.
We haven't made any changes to the DB or its settings. Does anyone know why this might be happening and how we can reset the log level?

How to change max_connections for Postgres through SQL command

We have a hosted PostgreSQL, with no access to the system or *.conf files.
I do have a admin access and can connect to it using Oracle SQL developer.
Can I run any command to increase the max_connections. All other parameters seems to be ok shared mem and buffers can hold more connections so there is not problem there.
Changing max_connection parameter needs a Postgres restart
Commands
Check max_connection just to keep current value in mind
SHOW max_connections;
Change max_connection value
ALTER SYSTEM SET max_connections TO '500';
Restart PostgreSQL server
Apparently, the hosted Postgres we are using does not provide this option. (compose.io)
So the work around is to use a pgbouncer to manage you connections better.

How to set connection timeout value for pgAdmin?

I am using pgAdmin to connect remotely to my database as phpPgAdmin is a bit limited in its features. Only problem is if I leave the SQL window open without running a query for a few minutes, then it says I need to reconnect.
Is this a setting I need to change in my database to keep remote connections alive for longer or is it a pgAdmin setting?
It is client setting.
You need specify connect_timeout in your config file.
29.1. Database Connection Control Functions
29.14. The Connection Service File