How to change domain of a field in IBExpert? - firebird

I wanted to change a field from D_ALPHA2NOTNULL to D_ALPHA8NOTNULL, so that I am able to use more chars. Unfortunately if I am trying to change the domain I am getting an error message:
action cancelled by trigger (2) to preserve data integrity.
Cannot update index segment used by an Integrity Constraint.

Related

How to search on a field that may be empty in zapier

Trying to sync up a postgres record to airtable on create/update. The field has a couple of ids that I would like to check for in airtable to determine whether I should create a new record or update an existing one. The first id (optional_id) I need to search on can possibly be null. This causes the search to fail before it can get to the other id(required_id) that should always be populated. Is there any way I can skip the initial search for optional_id if it turns out to be null in postgres?
My current outline is as follows:
I would use a Formatter > Text > Default Value step in case the input value can be null and then make sure the fallback value is from a record that does not exist.
If further help is needed, feel free to reach out to us here:
https://zapier.com/app/get-help

Parse Server Upgrade to v4.2: Unable to ensure uniqueness for user email addresses

I have recently upgraded parse-server to v4.2. I have also updated Mongo to v4.2 (It's a Replica Set configuration). Now when parse-server is raised, the following error appears "Unable to ensure uniqueness for user email addresses: Tried to ensure field uniqueness for a class that already has duplicates."
The detailed error is this:
{
"message": "Unable to ensure uniqueness for user email addresses: Tried to ensure field uniqueness for a class that already has duplicates.",
"code": 137,
"level": "warn",
"stack": "Error: Tried to ensure field uniqueness for a class that already has duplicates.\n at _adaptiveCollection.then.catch.error (/parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js:569:15)\n at <anonymous>\n at process._tickDomainCallback (internal/process/next_tick.js:229:7)"
The error is caused by the _User class that has the username and email fields with the same data.
Any ideas on how to fix the problem or make the parse-server not do this check.
The error message means that a unique index could not be created on the email field.
The unique index ensures that in the email field a value can only occur once, in other words, that it occurs uniquely. MongoDB cannot create such an index if there are already duplicate values in the email field that would violate the rule of uniqueness, in other words, an identical email address already appears multiple times in the collection.
Keep in mind that Parse Server 4.0 introduced a case-insensitive index for the the field email and username. If you already have a user with email email#example.com and another one with EMAIL#example.com, the index creation will also fail.
The solution is to remove the duplicate email entries and restart Parse Server, so that index creation will be attempted again.

Keeping two fields in sync when one of them is updated

The application I'm working on is a character based application. there is a field adfc.unme-code in a table and another field arbu.unit-code-shu. These two fields are shown in different windows but they must be in sync. When I update unme-code, unit-code-shu must be updated too.
Is a simple assign statement would be enough or should I do something else? Also, should I use the actual fields or a buffer?
You can use the ASSIGN statement in your code to assign both values at the same time. If there's a possibility of some other process changing those fields, you can create a database trigger procedures on each field to copy the value over to the other field. In the Data Dictionary, view the field properties and click on the "Triggers..." button to do that.
Yes, ASSIGN is used to set the value of a buffers/records field. However: certain critera needs to be met:
The buffer/record needs to be available.
You must have the "lock" of the buffer/record.
If you have the record available and locked you can simply do:
ASSIGN arbu.unit-code-shu = adfc.unme-code.
To make this code "safer" you can simply make sure that arbu is available and not locked by any other user. And finally it will handle if your assign fails because you have no lock at all.
IF AVAILABLE arbu AND NOT LOCKED arbu THEN DO:
ASSIGN arbu.unit-code-shu = adfc.unme-code NO-ERROR.
IF ERROR-STATUS:GET-NUMBER(1) = 396 THEN DO:
MESSAGE "Apparently the record is locked." VIEW-AS ALERT-BOX ERROR.
END.
END.
If you do not have the record (or the right locking) you need to look into your application and see how you can add this feature. What identifies the right record of the second table? A single id? Something else? Are there always a 1 to 1 relation between arbu and adfc etc?
Perhaps your application has a simple way of setting the value of a field. If there is a architecture at place you should try to stick to it...

CDC multiple insert/delete of the same identity value

I have a table T that contains an ID set as identity and primary key. I have enabled CDC on the table and then later added an XML field that I didn't care capturing so I did not do anything further (to recreate the capture table and/or migrate old capture data).
I now have a stored procedure that (among other things) updates only the newly created field (no other field) in table T. I notice that instead of recording an update (operation=3 followed by operation=4), CDC records a delete (operation=1) followed by an insert (operation=2) and all fields are the same (of course since none of them was updated)
I actually noticed this because I had the same identity value inserted and/or deleted more than once, which is not possible (unless identity_insert is on, which is not)
Why does CDC record operation=1 instead of 3 and operation=2 instead of 4?
Is this documented anywhere or is it a bug?
The reason you are seeing a Delete/insert pair (Operation number 1/2) as opposed to an update pair (3/4) is because you are updating a "set" of data that ALSO has a unique constraint on your column.
For SQL to make sense of this wihout violating the unique cosntraint, it deletes the row and reinserts it (with the "update").
More information on this. Its not an issue or a defect. its the way SQL works and CDC innocently logs it as it sees it. Remember, CDC is just a subscriber and replicates things as they happen.
If you have a need to see an update you may have to look for the 1/2 "pair" and not ONLY the operation code 3/4.
Some great articles:
Bounded Update is the term used to describe certain types of UPDATE statements from the publisher that will replicate as DELETE/INSERT pairs on the subscriber. We perform a bounded update for every set based update that changes a column that is part of a unique index or constraint. In other words, if an UPDATE statement touches more than one row and modifies a column that is has any UNIQUE constraints, the UPDATE statement is sent to the subscriber as a DELETE/INSERT pair ... read more here
https://support.microsoft.com/en-us/kb/238254

GWT + Editor: Avoid removing violation messages and wrong input

We implement in our GWT/GXT project displays that contain in most cases a filter form and a grid to show the filtered data. Displays are implemented with UiBinder and the "Gwt Editor Framework".
The user wants to have validations on the filter form. To do the validation we use JSR303 bean validation. The validation must apply on each change of a field in a filter form. The user wants also to have a kind of automatic fill a field based on the input in a second field (lets say a number range from and to). That works all perfect - but...
We struggle in a particular situation:
The user starts to type in some data in the filter form.
He puts a wrong value in a field that has to be parsed into a date (for example).
He continues typing into following fields which then cause an automatic prefill of a second field.
The result is currently, that the wrong value he typed into the date field is removed and the violation message as well.
Our current implementation will do a flush() to get the values the user typed in already. After that we fill a attribute in the model (based on the input) and do an edit(model). If there are some violation messages because of a wrong input in a different field in that filter form, the value is removed. That happens on field that need a parse (date, time, number).
The question is now:
Is there a way to keep the wrong value and the violation message as well?
Thank you for any replay!