Cant use uuid in nestjs + postgreSQL with backend hosted in railway - postgresql

Today i migrate my db from heroku to railway because heroku is no longer free. Everything went perfect, i migrated my db with all the data. I tried getting all the data and its also work fine, the problem is when i try to create for example a new user, im getting a UUID error.
ERROR [UserService] QueryFailedError: null value in column "id" of relation "user" violates not-null constraint
uuidv4 is not a function
I tried to solve the issue with CREATE EXTENSION "uuid-ossp"; and also updating timescaledb ALTER EXTENSION timescaledb UPDATE; but nothing works.
Im using Postgre 14 and typeorm.

The correct function in uuid-ossp extension is uuid_generate_v4(). However that extension is not required as v14 contains the built in function gen_random_uuid() which generates a version 4 uuid. See Documentation

Related

Alter Type in PgSQL to rename attribute not working

I am trying to rename an attribute of a Type in PgSQL using following Alter command
ALTER TYPE typeName
RENAME ATTRIBUTE attrNameOld TO attrNameNew
CASCADE
PgSQL version is 9.5, running on Ubuntu 16.04
However, I receive following error on my Pgsql CLI
ERROR: relation "<typeName>" does not exist
Please help. Thanks.
So, I can't rename an Attribute in PostgreSQL version <10. Thanks to Stephen for sharing the stackoverflow answer.
Alternatives are available though
Remove the Type. Create anew with right Values, and update Table references
Update Catalogs

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.

Postgrex migration fail, undefined object jsonb

I am trying to use guardian_db for managing jwts.
However, when I try to migrate guardian_db schema, it triggers an error, (undefined_object) type "jsonb" does not exist.
I found a similar issue on github ecto repository, https://github.com/elixir-ecto/ecto/issues/1078. It says jsonb is supported from Postgres 9.4.
I am using Postgres 9.6.1 but still experiencing this issue.
Any suggestions?

PostGIS installed, but unable to select version or add geography columns

I've got an existing Postgres 9.6 database on Google Cloud that has the PostGIS extension enabled, however whenever I try to create a table with a column with the geography type or select the PostGIS version I get an error.
For creating the geography column the error is non-descriptive — just an arrow pointing to the word geography in the following statement
create table place(coordinate geography(POINT,4326));
The version error looks as follows:
select postgis_full_version();
ERROR: could not access file "$libdir/postgis-2.3": No such file or directory
CONTEXT: SQL statement "SELECT postgis_lib_version()"
PL/pgSQL function postgis_full_version() line 22 at SQL statement
The create extension statement confirms it is already installed though e.g
create extension postgis;
error: the extension already exists
I've tried running these commands as the postgres user and as another user who's been granted permissions on the database in question but neither seem to work. Any help would be appreciated.
It's simpler than you think:
Your hosting privider has goofed up the PostGIS installation.
It looks like the file is really missing, or something else on the operating system level is misconfigured.
You should gripe at Google.

Trying to set constraint - new primary key in table, but getting an error: column "amgettuple" does not exist (pgadmin3)

I am creating a new table using pgadmin3 and when I click on constraints to add a primary key, I get this error:
I searched on google but I'm not finding this "amgettuple" issue. Does anyone know what this means? I am new to postgres and using pgadmin, just set it up an hour ago.
Postgres version: 9.6
pgadmin version: 1.22.2
linux mint 18
Install pgAdmin 4. pgAdmin III was supported up to 9,5 version I think.
I am also using pgAdmin 3 and got that error. I fixed it by using the Query Tool:
ALTER TABLE table_name
ADD primary key (column_name);