Postgres giving error on update - postgresql

I am using Postgresql persistence provider with Thingworx. When I am trying to run a service for ConnectivityActivation I am getting the following error
Cause: Execute Update failed: org.postgresql.util.PSQLException: ERROR: syntax error at or near "on"
Position: 145
When I tried this on some other thingworx server then I wasn't getting this error.
I am thinking in the direction that this might be some issue with the permissions but I am not able to find the root cause for this issue.
Please let me know if my understanding is correct or there could be some issue with the postgresql database.
The query run is
insert into transactiondata
("transId","category","api","devId","timestamp","state","country")
values ('123','category','api','123456','','Active','India')
on CONFLICT ("transId")
DO UPDATE SET "state" = 'Disabled', "timestamp" = '' ,"category" = 'NA';

Related

ERROR: syntax error at or near "$" Position: 40 [Failed SQL: (0) SET SEARCH_PATH TO <SchemaName>, $user, public]

We are using liquibase to deploy the data warehouses. We are facing the issue with the default schema name property of liquibase. When we set the value for the same to the schema in which we want the deployment to be done, it gives the following error -
Caused by: liquibase.exception.DatabaseException: ERROR: syntax error
at or near "$" Position: 40 [Failed SQL: (0) SET SEARCH_PATH TO
, $user, public]
The $user, should be in quotes and hence the issue is occurring. Is anyone also facing a similar issue with Redshift while deploying databases using liquibase?
https://docs.aws.amazon.com/redshift/latest/dg/r_search_path.html
Looks like the issue is related to Liquibase version 4.11.0, just use Liquibase v4.10.0
Instead of using --defaultSchemaName parameter, use --liquibase-schema-name parameter to set the schema for liquibase tables.
workaround
execute in database something similar
ALTER USER user_name SET search_path to 'public'

data corrupted in postgres - right sibling's left-link doesn't match: block 9550 links to 12028 instead of expected 12027 in index "log_attach_id_idx"

I am new to Postgres and we are using it for tests reports, we had an issue with our environment that entered duplicate keys to one of the table and since then we are getting this message when trying to run migration scripts:
error: migration failed: right sibling's left-link doesn't match: block 9550 links to 12028 instead of expected 12027 in index "log_attach_id_idx" in line 0: UPDATE log SET project_id = (SELECT project_id FROM item_project WHERE item_project.item_id=log.item_id LIMIT 1); (details: pq: right sibling's left-link doesn't match: block 9550 links to 12028 instead of expected 12027 in index "log_attach_id_idx")
I tried to run pg_dump and got this error:
pg_dump: error: query was: SELECT pg_catalog.pg_get_viewdef('457544'::pg_catalog.oid) AS viewdef
pg_dumpall: error: pg_dump failed on database "reportportal", exiting
Can anyone help here?
Restore your backup, and research what parameters you changed and what you did to end up with data corruption in the first place.

ODatabaseException OrientDB Record Error

I'm struggling to fix my orientdb database. I'm getting the error:
Error: com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #58:65894 (cluster: cluster_name_here)
I'm running REPAIR DATABASE --fix-graph and that's when i get this error. Is there any other suggestions in approaching this? This is also the case when running CHECK DATABASE
I tried using this link as a resource: https://orientdb.com/docs/last/Console-Command-Repair-Database.html

While connecting with ORM in Codeigniter getting a invalid Database error

[https://github.com/maltyxx/origami][1]
I am getting invalid database error while trying to use the ORM Composer from github .
The error is like :
You have specified an invalid database connection group (test) in your config/database.php file.
But in config/database.php i have given it clearly. Please help me on that.

error when trying to execute to sql

I'm using Mulestudio and am trying to insert into the Postgres database some data. I am modifying the log4j.properties file and below is how it looks like:
log4j.rootLogger = DEBUG, postgres
#
log4j.appender.postgres=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.postgres.layout=org.apache.log4j.PatternLayout
log4j.appender.postgres.driver=org.postgresql.Driver
log4j.appender.postgres.URL=jdbc:postgresql://127.0.0.1:5432/testing
log4j.appender.postgres.user=postgres
log4j.appender.postgres.password=pw
log4j.appender.postgres.sql=INSERT INTO LOGS VALUES ('%x', '%d{yyyy-MM-dd}','%C','%p','%m');
The error message that I get is
log4j:ERROR Failed to excute sql
org.postgresql.util.PSQLException: ERROR: syntax error at or near "edu"
'edu' is the first part of my project name (edu-stream-ucdnews). The instance of 'edu' only comes up in the title name and not in my data. I know that the error arises when I have the '%m' when I try to insert the data because when I change it to a hard-coded message like 'Hello', I don't get any error.
How do I solve this issue?
Are you sure your are connected to the database?
Try putting the fields name in your sql and lets check if we get a better error log:
log4j.appender.postgres.sql=INSERT INTO LOGS (field1, field2, ...) VALUES ('%x', '%d{yyyy-MM-dd}','%C','%p','%m');