How do I upgrade an RDS instance's PostgreSQL version using TerraForm? - postgresql

My current RDS instance is running PostgreSQL version 9.6.3, but I'd like to upgrade it to version 10.1. However, when I set the new version number in my TerraForm configuration and set allow_major_version_upgrade to true, I run into the following error:
Error: Error applying plan:
1 error(s) occurred:
* aws_db_instance.db_instance: 1 error(s) occurred:
* aws_db_instance.db_instance: Error modifying DB Instance db-example: InvalidParameterCombination: Cannot find upgrade path from 9.6.3 to 10.1.
status code: 400, request id: <id>
In fact, I get a similar error message when I set 9.6.4 as the new version number - which already is confusing, since auto_minor_version_upgrade is also set to true, yet the instance is still at 9.6.3.
As you can see, there's still a lot of RDS and PostgreSQL I have to come to grips with, so any background info that can help me understand the problem would be very welcome as well.
Edit:
After setting just allow_major_version_upgrade to true without actually modifying the version resulted in this error:
* aws_db_instance.db_instance: Error modifying DB Instance db-example: InvalidParameterCombination: No modifications were requested

As #ydaetskcoR pointed out, you can only upgrade to PostgreSQL versions actually supported by RDS, which is 9.6.5 at the moment.
The upgrade from 9.6.3 to 9.6.5 as a result of auto_minor_version_upgrade will also not happen as soon as it is supported, as described in an email Amazon sent a while ago:
Beginning January 22 2018, if your database instances have the “Auto Minor Version Upgrade” option enabled, we will automatically upgrade your PostgreSQL database instances, using the same scheme mentioned above, during your maintenance window. If you do not wish to apply these upgrades at this point in time, please set the “Auto Minor Version Upgrade” option to "No" before January 20, 2018.

Related

You have specified a database that is not empty, please specify an empty database

I'm trying to connect to an RDS cluster in AWS that's an Aurora PostgreSQL database. It's a brand-new database that I created along with the instances that I have Jira deployed to. However, when I try to connect to the instance from the Jira configuration screen I get this error
You have specified a database that is not empty, please specify an empty database.
I haven't touched this database at all, why is it giving me this error? I have one read and one write database in my cluster and the "hostname" is the endpoint for my write database, which is what the docs say. Could this be an issue with the Jira version I'm using?
This is the download link I'm using in my user-data script to install Jira. I'm also using PostgreSQL version 12.11
https://www.atlassian.com/software/jira/downloads/binary/atlassian-servicedesk-4.19.1-x64.bin
I switched to a different PostgreSQL version and now it's working.
PostgreSQL version 12.11 was giving me the error and switching to version 13.7 works as expected.

RDS upgrade postgres version 13.1, unsupported DB Instance Class

I'm trying to upgrade from version 12.5 to the version 13.1 in RDS. But I'm receiving an error similar to the one described in this question: RDS does not support creating a DB instance with the following combination. As far as I understand in order to upgrade a proper version DB instance class should be selected. However the error message shows a previous selection, not a new one. Same message is received in Terraform setting up
engine_version = "13.1"
instance_class = "db.t3.small"
Screenshot from AWS showing the changes and message:
Copied error message to make it easier to research:
We're sorry, your request to modify DB instance [service-name] has failed.
RDS does not support creating a DB instance with the following combination: DBInstanceClass=db.t2.small, Engine=postgres, EngineVersion=13.1, LicenseModel=postgresql-license. For supported combinations of instance class and database engine version, see the documentation.
Is there some key to allow_instance_class_change (a made up key) or something else I overlooked what prevents an upgrade? Thank you!
I would suggest upgrading to T3 first, then upgrading to PostgreSQL 13. If you need to do those at the same time you might have better luck going through the API, but I'm guessing the way the version 13 upgrade works you need to already be on a supported instance type for the upgrade to proceed.

Getting Invalid schema name error on postgresql RDS after upgrading from 9.3 to 9.4

As pointed by amazon that PostgreSQL 9.3 is deprecated and need to upgrade our version of PostgreSQL to upper version, we just upgraded our version to 9.4. But after upgrade we are not able to do any save() operation from your Yii 1.1 project locally but the operation is working fine from the server.
When we try to run our project from locally and connect the remote PostgreSQL, we got the below error.
{"error":"SQLSTATE[3F000]: Invalid schema name: 7 ERROR: schema
\"publicubfo06sm23qicfa8kmm0nrv3td81qf928i\" does not
exist","try":"end"}
When I try to see my existing schemas using,
SELECT table_name FROM information_schema.tables
I got 3 values namely 'public','pg_catalog', 'information_schema'
Also want to mention that previously with our version 9.3 we were able to do model operations on Yii 1.1 like $model->save() and then immediately get back the primary key value using $model->id or $model->getPrimaryKey() but now it is not working. Only the $lastId = Yii::app()->db->getLastInsertID('tbl_user_group_id_seq'); way is working now.
Can anyone point me out what is the reason behind it? is something get lost while upgrading from 9.3 to 9.4 like schema, role, sequence or anything else that is causing the errors now to access my RDS from local machine.

phraseto_tsquery in PostgreSQL 9.5x or just from 9.6x?

I'm finding references in the 9.5 manual to phraseto_tsquery
https://postgrespro.com/docs/postgrespro/9.5/textsearch-controls
But if I use it in my query it gives me this error:
No function matches the given name and argument types.
SELECT phraseto_tsquery('english', 'The Fat Rats');
Was this function not added with 9.5 as intended or is it likely there's some other problem on my side. Running 9.5.4 of the database currently. Anyone that can confirm?
For anyone looking; took the step to install postgresql 9.6beta4 and I'm no longer receiving the error message. In other words phraseto_tsquery seems to only be fully supporting in the current 9.6 beta and upcoming full release.

org.sonar.api.utils.MessageException: Database relates to a more recent version of sonar

I am facing the below error.
org.sonar.api.utils.MessageException: Database relates to a more recent version of sonar. Please check your settings.
i have 2 different servers. one for sonar and another for database.
1. I have taken snapshot of sonar server, but i didnot take snapshot for database(forgot to take it).
2. I have upgraded sonar from sonar 4.0 to sonarqube4.5.1 after taking backup of database(postgresql) using pg_dump command... but as i have faced some loss of data after upgrading sonar and database i have reverted back to previous snapshot (sonar server)
3. now we have done restoring the database using pg_restore command successfully but the sonar 4.0 is not getting started and gives the above error
could anyone help me with this
Message is quite obvious. You are starting your SQ 4.0 instance connected to a DB which is recognized as more recent.
Options are limited:
either the DB is really your original SQ 4.0 DB and you are not running the exact same SQ 4.0 software you used to
or you are running the same SQ 4.0 software and the DB is not your original SQ 4.0 DB
My guess is that you did not successfully restore your DB to its SQ 4.0 state, or only partially.
Under the hood, SQ uses table schema_migrations to know which version of the DB it is connected to.
Each db migration "script" (lets use that name for simplicity sake) has a unique number (number is strictly increasing) and each SQ version knows the number of the last migration script it bundles. When a script is successfully executed, a row is added to table schema_migrations.
SQ checks at startup its last script's number against the highest number in schema_migrations:
same number, everything is ok
lower number, DB needs an upgrade
higher number, the error message you got