Part of Database drivers: the hub. 54 entries under this heading; every entry opens as its own topic.
- A unique key with "Exclude Empty Keys" raises duplicate errors after moving to SQL - NULL, not zero; the SQL Server filtered index.
- Auto-increment numbers skip after a cancelled insert - hidden SysID plus a locked counter for the visible number.
- Firebird: testing a generator and priming the next value - GEN_ID from RDB$DATABASE, trigger vs PrimeFields.
- MSSQL: a table created by the application has no IDENTITY(1,1) on the auto-number column - the driver's CREATE never emits IDENTITY; script the table yourself.
- MSSQL: "Cannot insert explicit value for identity column" after adding an Identity column - mark the column as the server auto-number so the INSERT leaves it out.
- PostgreSQL: error 89 on the first save of a new record when the table has a GENERATED column - the generated column must leave the concurrency check:
| WATCHon the id. - MSSQL: one table keeps getting dropped and recreated empty in production - a failed OPEN becomes a CREATE, and CREATE is DROP + CREATE; switch table creation off.
- Moving from TPS to PostgreSQL: do my dictionary KEYs need matching indexes on the server? - keys drive ORDER BY only; PROP:WHERE before SET.
- Oracle: On Delete Restrict lets a parent with children be deleted on one network but not another - how client-side Restrict reads the child; enforce it on the server.
- Autonumber for one application that must run on MS SQL and on Firebird through ODBC - let the back end generate the number; the poster
- SQL Server: "Record Changed by Another Station" on a table with an identity field and a trigger-updated column - POSITION() then REGET() before the change refreshes Clarion
- Porting TPS auto-increment fields to MS SQL identity columns while keeping the existing numbers - switch the identity off temporarily so the old values can be inserted.
- MSSQL: "explicit value for the identity column ... IDENTITY_INSERT is OFF" when TryInsert runs from one module first - External Name
ulDsnr | READONLYwith a blank before the pipe, so the driver leaves the column out of the INSERT. - MySQL: a virtual or generated column makes the insert fail ("value specified for generated column is not allowed", S1000) - put the READONLY switch in the column's External Name (
reverse_pad | READONLY); the browse still reads it. - MSSQL: is Clarion's client-side auto-numbering safe, or should the server do it? - let the server number the rows with IDENTITY, a Sequence or a GUID key; the thread was close to unanimous.
- Pervasive 8.5: auto-increment key works on a Clarion-created file but gives error 40 on a file created in Pervasive SQL (Reported, not reproduced) - the poster traced it to a null flag setting; a regular key with Clarion-generated numbers was the other suggestion, and the thread ended without a confirmed fix.
- MS SQL: when user 2 presses Add while user 1 is still on the form, user 2 gets a duplicate key error - the form adds a blank record before it opens, so prime every field of the unique key with a distinct value in the PrimeFields embed.
- PostgreSQL: Insert or TryInsert does not store 0 in an empty numeric field - give the column a default of 0 on the server and check its NOT NULL setting; Clarion leaves an empty numeric field out of the INSERT.
- PostgreSQL: getting the new primary key value after an insert (serial or sequence versus a GUID) - call the sequence directly when the form starts, or use a GUID built in the key's Initial Value so the value exists before the insert.
- PostgreSQL: an auto-incremented LONG ID stops at 2147483647, and what to use for bigger IDs - a Clarion REAL turns into a PostgreSQL double precision and held much larger IDs; bigint with DECIMAL, two LONGs and a GUID string were the other suggestions.
- PostgreSQL: an optional parent (an item with no category yet) when relationships move from the dictionary to the database (Reported, not reproduced) - a foreign key column may hold NULL; start the category column as NULL with SETNULL() in the field priming, or use a default "Uncategorised" row; no result was posted.
- PostgreSQL: a serial id column is saved as 0 and the second insert fails with 23505 duplicate key - write
FieldName | ReadOnlyin the field's External Name so the driver leaves the column out of INSERT and UPDATE and the server default fills it; or call nextval first. - PostgreSQL: a READONLY key field still needs the nextval driver setting, or the insert gives a driver error (Reported, not reproduced) - a column default of nextval, or a trigger, with READONLY or an explicit NULL so Clarion sends nothing; the switch needs a space after the column name; nothing was confirmed.
- PostgreSQL: should a dictionary primary key be an index or a constraint on the server? - create it as a primary key constraint (
alter table ... add constraint ... primary key), or a unique index plus NOT NULL; the poster's legacy conversion app had created indexes only. - Server-side auto-increment fails although IsIdentity is set: PROP:ServerAutoInc missing on a source procedure - set the user option
IsIdentity = TRUEso the template emits PROP:ServerAutoInc, or use| READONLY; in the poster's case the template left it out of his source procedures, so check the generated code. - MySQL over ODBC: "Record changed by another station" on some records of an imported table (Reported, not reproduced) - the error needs a failed UPDATE with a WHERE on the old values; isolation settings and logging were suggested; no cause was found.
- MySQL over ODBC: "Record changed by another station" when adding a new record - one poster cured it with two changes together: clear the CSTRING fields to zeros in PreInsert, before any other assignment, and use the date/time/OVER group method for dates and times.
- MySQL: getting the AUTO_INCREMENT value after adding a record - after the ADD,
Select Last_Insert_Id()through PROP:SQL and NEXT, then fetch the record by that key; it needs an insert in the same session. - PostgreSQL: a multi-column sequence (counter restarting per parent value); no built-in way, use row_number() - keep a normal serial column and compute the group number on reading with
row_number() over (partition by ...), in a view. - MSSQL 2008 Express: "Record was changed by another user" and "Invalid character value for cast specification" on update (Reported, not reproduced) - the connection string is no different for 2008; a field defined differently in the table and the dictionary was the usual cause; no outcome was posted.
- PostgreSQL: getting dictionary relations created as foreign key constraints on the server (Professional Edition) - Clarion does not push relations to the server; the DCT2SQL templates can write the foreign key statements, and one poster needed an edited template to get them.
- Multi-component auto number key: does the last component restart for each value of the higher components? - yes, the last field is numbered per value of the higher ones; prime the higher components yourself; a string last component needs a numeric picture as long as the string to collate properly.
- DCT2SQL Firebird script gives error 47: check reserved field names, then mark the identity field read only - rename fields that are Firebird reserved words and compare a read-back dictionary with the original; tick Read Only on the server identity field so Clarion never writes it.
- MSSQL: an identity column does not autonumber, and a blank child key then raises an RI constraint error - tick Read Only on the column, or drop the identity and tick Autonumber on the key; for the blank child key give it a default, relax the RI on that relation or allow nulls.
- Synchronizer reports errors and generates no table for a many-to-many link table with no unique key - give the link table its own unique primary key, generated by the back end, and never let the user or the program update it; the poster reported it solved.
- SQL insert into a many-to-many link table fails with a referential integrity constraint error: the constraint lives in the database - The foreign key constraint is enforced by the database, so write the parent first; here, re-creating the dictionary keys and relationships made the insert work.
- Firebird: the generator value is used up when an insert is rejected, leaving gaps in the numbers - A generator value is used even when the insert is rejected, so gaps are normal; fetch the value with GEN_ID or a stored procedure if you need it.
- MySQL over ODBC: "record was changed by another user" with no other users, on a form with a date field - A zero date is not NULL in SQL; let the column accept NULL and use ZEROISNULL or SetNull, or require a valid date.
- Access over ODBC: one PUT updated all of a customer's invoices, with "WHERE ... IS NULL" in the trace - Without a PRIMARY key Clarion used the first non-DUP key, a nullable text column, giving WHERE IS NULL; declare the real PRIMARY key.
- MS SQL 2005: inserting a record in the child browse fails on the parent key (two browses on one window) - Carry the parent id as a hot field or hidden column, pass it to the child form as a parameter, and prime the child key from it.
- Adding a SysId and primary key to every table of a dictionary moving from TPS to SQL: do you need to? - Keep natural primary keys, add a generated id as the last key component only where needed, and script the ALTERs when a new key is required.
- MSSQL: how to get the server-assigned ID of a new record so a related record can be added - Use a free auto-increment template, or add a unique second key and fetch the row back after the insert to read the server-assigned ID.
- MSSQL: adding a new column also creates a DEFAULT constraint - why, and can it be dropped? - SQL Server needs a default or null for existing rows when adding a column; the constraint can be dropped afterwards, but the thread found no switch to stop it.
- Auto-increment fields over ODBC (Postgres, MS SQL, Firebird): IsIdentity, EMULATEAUTONUM and the /AUTOINC driver string - Set IsIdentity and EMULATEAUTONUM in the DCT, use serial plus an /AUTOINC currval string on Postgres, and choose server side or client side, not both.
- InterSystems Cache with Clarion: every file needs the internal id field as a read-only primary key - InterSystems Cache has its own internal id field, so give every dictionary file that id field as the primary key and set it read-only.
- MSSQL: getting the auto-incremented UID value after an insert with Access:xxx.Insert() - Clarion's own fetch-highest-plus-one retry works if the server rejects duplicate keys; the last-identity function reads the server value, but a trigger insert can spoil it.
- MSSQL: inserting explicit identity values during a migration, ADD still leaves the identity column out (Reported, not reproduced) - SET IDENTITY_INSERT ON was advised, but Legacy ADD still left the identity column out; removing the primary key property and checking IsIdentity or ReadOnly were suggested; no outcome posted.
- PostgreSQL: after adding an auto-number column to an existing table, adding a record gives "Unsupported File Driver Function (80)" - Error 80 on adding a record to a PostgreSQL table with a new auto-number column was cured by adding an /AUTOINC currval clause to the driver string, then a sequence default plus SETVAL.
- READONLY in a field's External Name: it kept the column out of INSERT but not UPDATE (Reported, not reproduced) - The READONLY switch in the External Name kept a column out of INSERT but posters disagreed whether it holds on UPDATE; no test settled it.
- MSSQL: error 2714 "There is already an object named ..." when creating the indexes from a TPS dictionary - SQL Server index names must be unique across all objects; rename the dictionary keys with a prefix convention before generating the scripts.
- MSSQL: a uniqueidentifier primary key - getting the new GUID for parent and child inserts - Get the GUID before the insert so child rows can use it: call a small procedure that returns NEWID(), or generate it in a FileManager-derived class.
- PostgreSQL ODBC: "Function sequence error" (S1010) when a form is cancelled, or in a browse with drop combos (Reported, not reproduced) - S1010 function sequence error on cancel; one poster guessed the auto-increment record handling, another saw it stop after removing the drop combos from an EIP browse.
- After converting from TPS to SQL the app shows "record not found" (error 33) messages: check the primary key and the declarations - Error 33 after a TPS to SQL move usually means no primary key declared, key columns missing from the browse, or Clarion and SQL declarations that differ.
- MSSQL: a browse shows the same rows again and again, or mirrored, when scrolling - Repeated or mirrored browse rows: declare the unique key as PRIMARY in the dictionary, put it in the list or Hot Fields, add it to the sort order; one case was an add-on browse template.