You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] extract primary keys from ALTER TABLE .. ADD CONSTRAINT.. . PRIMARY KEY (...); #1817
When parsing a CREATE TABLE, we have built-in functions to retrieve the PRIMARY KEYS in JSQLParser.
But in the case where the CREATE TABLE does not contain the PRIMARY KEYS, which are added later with an ALTER TABLE:
CREATE TABLE public.staff (
staff_id integer DEFAULT nextval('public.staff_staff_id_seq'::regclass) NOT NULL,
first_name character varying(45) NOT NULL,
last_name character varying(45) NOT NULL,
address_id smallint NOT NULL,
email character varying(50),
store_id smallint NOT NULL,
active boolean DEFAULT true NOT NULL,
username character varying(16) NOT NULL,
password character varying(40),
last_update timestamp without time zone DEFAULT now() NOT NULL,
picture bytea
);
Done later in file:
ALTER TABLE ONLY public.staff
ADD CONSTRAINT staff_pkey PRIMARY KEY (staff_id);
I can't figure out how to retrieve the PRIMARY KEYS without doing manual parsing of the ALTER TABLE.
Is there a way in JSQLParser?
(I can't in my case just move the PRIMARY KEYS creation in the staff table, because I write a schema displayer that takes in new schemas texts that I know nothing about).
Activity