New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to generate mock data for Oracle table with auto-generated Identity #4387
Comments
Similarly, when generating an Insert Statement, it generates: INSERT INTO PEOPLE
(ID, FIRST_NAME, LAST_NAME, CREATED_AT, UPDATED_AT)
VALUES("SP_PLUGINS"."ISEQ$$_123968".nextval, '', '', '', ''); The ID column, and associated sequence, should not be included in the generated SQL. |
Please check it in 5.2.4. |
What do you mean by "although there are no auto-generated columns in Oracle"? Here is how to detect virtual (=generated) columns on Oracle: https://stackoverflow.com/questions/8074963/how-to-check-column-is-virtual-in-oracle |
Virtual column is a different thing. As well as column with default value set to some sequence increment function. |
@serge-rider Oracle does indeed have auto-generated columns, as of 12c. Also, see my DDL above. Notice the ID column is I believe DBeaver should always skip columns that are marked as CREATE TABLE "IDM"."PEOPLE"
( "ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE NOKEEP NOSCALE NOT NULL ENABLE,
"FIRST_NAME" VARCHAR2(100) NOT NULL ENABLE,
"LAST_NAME" VARCHAR2(100) NOT NULL ENABLE,
"CREATED_AT" TIMESTAMP (6) NOT NULL ENABLE,
"UPDATED_AT" TIMESTAMP (6) NOT NULL ENABLE,
CONSTRAINT "PEOPLE_PK" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS"; |
I agree you cannot detect columns generated with trigger: digging into trigger sources to detect it is something nobody should dare trying. Nevertheless, virtual columns can be detected will all_tab_cols, and they are very different from columns with a default attribute: they don't have a stored value, they are calculated based on the function you give them in the generated clause, and putting them in the insert clause will generate an error. That's why I advocate detecting them for this feature (and also for data export where there is a checkbox to skip generated columns). As for detection of 12c identity columns, I'm not sure if the same method would work but surely one of the all_* views is going to contain the information. |
So, I just took another look at the page that I referenced above. I have only ever used the In any case, I believe the default behavior for generation of mock data, as well as generating the INSERT statements, should be to ignore the column if it is |
Given a table created with the following DDL
When I try to use the Mock Data generator, I see the following screen:
When trying to run this, I get
If I set the Identity column to NULL, instead of Numeric Sequence, I get:
In this case, the Identity column should not be set, so we need to exclude it completely.
The text was updated successfully, but these errors were encountered: