Problem im facing - only some columns gets detected
Created a source and target endpoints and a replication instance ( connection tested for both )
Want to copy a table called users that look like this :
Mapping rules :
I insert data on source DB
INSERT INTO users VALUES(13,'test');
But on target DB i get a weird error on awsdms_apply_exception table
ERROR - RetCode: SQL_ERROR SqlState: 23502 NativeError: 1 Message: ERROR: null value in column "name" of relation "users" violates not-null constraint;
Error while executing the query
As #NItin Vaja said
Problem was table column 'id' wasn't primary key.
Recreated the table with 'id' as a primary key and the
n migration worked !
Related
Is it possible to check the (not null) constraints ion the target database table before writing the data into the target database table?
Is there anyway to handle the below exception in pyspark?
java.sql.BatchUpdateException: Batch entry 4 INSERT INTO public.empl ("id","name") VALUES (5,NULL) was aborted: ERROR: null value in column "name" of relation "empl" violates not-null constraint
I want to write data into a table via pyspark. But, I'm getting not null constraint error. I need to handle it without termination
I have a table 'client', which has 3 columns - id, siebel_id, phone_number.
PhoneNumber has a unique constraint. If I save a new client with an existing number, I'll get an error ERROR: duplicate key value violates unique constraint "phone_number_unique".
Is it possible to make PSQL or MyBatis showing 'siebel_id' of a record where the phone number already saved?
I mean to get a message like
'ERROR: duplicate key value violates unique constraint "phone_number_unique"
Detail: Key (phone_number)=(+79991234567) already exists on siebel_id...'
No, it's not possible to tweak the internal message that the PostgreSQL database engine returns accompannying an error. Well... unless you recompiled the whole PostgreSQL database from scratch, and I would assume this is off the table.
However, you can easily search for the offending row using SQL, as in:
select siebel_id from client where phone_number = '+79991234567';
Was solved
We have 2 schemas in the db: public and umler.
After that, the dba team has generated the spring batch schema to both schemas above.
And the foreign key was set:
umler.job_inst_exec_fk (job_instance_id reference to public.batch_job_instance(job_instance_id) ) =)))
----------------Problem-------------------
I was using spring batch in springboot,in which I had a postgres datasource for the job. But when I ran the job, I've got the error:
Detail: Key (job_instance_id)=(72) is not present in table "batch_job_instance".; nested exception is org.postgresql.util.PSQLException: ERROR: insert or update on table "batch_job_execution" violates foreign key constraint "job_inst_exec_fk"
Detail: Key (job_instance_id)=(72) is not present in table "batch_job_instance".] with root cause
org.postgresql.util.PSQLException: ERROR: insert or update on table "batch_job_execution" violates foreign key constraint "job_inst_exec_fk"
Detail: Key (job_instance_id)=(72) is not present in table "batch_job_instance".
The step that I can see are:
Find the job by name
if not existing, will create a new record into job_instance (with id = 72)
Inserting new record into the job_execution. At this step we would meet the error.
Was solved
We have 2 schemas in the db: public and umler.
After that, the dba team has generated the spring batch schema to both schemas above.
And the foreign key was set:
umler.job_inst_exec_fk (job_instance_id reference to public.batch_job_instance(job_instance_id) ) =)))
I have a question concerning the error messages in PostgreSQL.
I noticed that in case of some failure PostgreSQL make a report in the form of text message but it does not contain error code id.
For instance:
ERROR: Relation "mytable" already exists or
ERROR: duplicate key value violates unique constraint "id"
Could you please suggest a way to make PostgreSQL including native error code id to messages for instance as follows:
42P07 ERROR: Relation "mytable" already exists or
23505 ERROR: duplicate key value violates unique constraint "id"
.
Is it possible ?
Thanks in advance.
You can change the parameter log_error_verbosity in postgresql.conf file to change the amount of information being logged during errors. By default, its value is default. You can change it to verbose to include more information about the errors.
I did a database backup and then I am trying to do a restore now but I got this error when I do the restore
gbak: ERROR:violation of FOREIGN KEY constraint "FK_WINDOW_4" on table "WINDOW"
gbak: ERROR: Foreign key reference target does not exist
gbak: ERROR: Problematic key value is ("QUOTE_ID" = 107)
I checked and I found the target ID QUOTE_ID = 107 already exists so why I get this error or where I should look at ?
There was a previous error precede this one, about a field was set as not null and there was some records has this field as null so when I fixed this error and tried again to do backup and restore I did not get any more errors.