Skip to content
Advertisement

Tag: postgresql

How should I use `json field` in where clause in postgresql?

I have a json field in postgresql table feeAmount: I’d like to query rows whose feeAmount -> value is not null. Some rows may be null for the entire feeAmount field. some rows’ feeAmount has a json data whose value is null. They need to be excluded. I have tried this query: but both of the queries return the rows

How do I change a text to an enum type?

so basically I want to import a csv file and one of the columns has the data yes/no in it and I have created an enum that has values ‘red’ and ‘white’ and the yes related to ‘red’ in the enum and no relates to ‘white’ in the enum and the column in the table in the database is of

How to fix Encoding error utf-8 – PostgreSQL

I am following instructions online to create a database in pgAdmin4. I have successfully imported a csv file and created a table. However, I cannot select anything from the table. My code is: SELECT * FROM transfers; Error message is: ‘utf-8’ codec can’t decode byte 0xc3 in position 0: unexpected end of data Running ‘show server_encoding’ gives “UTF8” in the

How to add a column default?

I created a Postgres DB which contains 5 tables. Then I realized that the column student.student_id lacks a column default to generate an UUID: Knowing that some tables are linked to the student table, how can I add to the function as column default for student_id so that the result will be: Answer Use ALTER TABLE: Column defaults do not

Advertisement