Skip to content

Commit

Permalink
fix: support for capital letters in sequence names (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeeva authored Sep 6, 2024
1 parent ff580ca commit 885e234
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pgbelt/util/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ async def dump_sequences(
# Get all sequences in the schema
seqs = await pool.fetch(
f"""
SELECT '{schema}' || '.' || sequence_name
SELECT '{schema}' || '.\"' || sequence_name
FROM information_schema.sequences
WHERE sequence_schema = '{schema}';
WHERE sequence_schema = '{schema}' || '\"';
"""
)

Expand All @@ -28,7 +28,7 @@ async def dump_sequences(
proper_sequence_names = []
for seq in targeted_sequences:
if f"{schema}." not in seq:
proper_sequence_names.append(f"{schema}.{seq}")
proper_sequence_names.append(f'{schema}."{seq}"')
else:
proper_sequence_names.append(seq)
targeted_sequences = proper_sequence_names
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/files/test_schema_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ALTER TABLE public."UsersCapital" OWNER TO owner;

CREATE TABLE public."UsersCapital2" (
id bigint NOT NULL,
hash_firstname text NOT NULL,
"hash_firstName" text NOT NULL,
hash_lastname text NOT NULL,
gender character varying(6) NOT NULL,
CONSTRAINT users_gender_check CHECK (((gender)::text = ANY (ARRAY[('male'::character varying)::text, ('female'::character varying)::text])))
Expand Down Expand Up @@ -62,15 +62,15 @@ CREATE INDEX users2_idx ON public."UsersCapital" (
-- Name: userS_id_seq; Type: SEQUENCE; Schema: public; Owner: owner
--

CREATE SEQUENCE public.userS_id_seq
CREATE SEQUENCE public."userS_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


ALTER TABLE public.userS_id_seq OWNER TO owner;
ALTER TABLE public."userS_id_seq" OWNER TO owner;

--
-- Name: users2_id_seq; Type: SEQUENCE; Schema: public; Owner: owner
Expand Down Expand Up @@ -111,7 +111,7 @@ INSERT INTO public."UsersCapital" (id, hash_firstname, hash_lastname, gender)
-- Data for Name: Users2; Type: TABLE DATA; Schema: public; Owner: owner
--

INSERT INTO public."UsersCapital2" (id, hash_firstname, hash_lastname, gender)
INSERT INTO public."UsersCapital2" (id, "hash_firstName", hash_lastname, gender)
VALUES (1, 'garbagefirst', 'garbagelast', 'male'),
(2, 'garbagefirst1', 'garbagelast1', 'female'),
(3, 'sdgarbagefirst', 'dgsadsrbagelast', 'male'),
Expand All @@ -123,7 +123,7 @@ INSERT INTO public."UsersCapital2" (id, hash_firstname, hash_lastname, gender)
-- Name: userS_id_seq; Type: SEQUENCE SET; Schema: public; Owner: owner
--

SELECT pg_catalog.setval('public.userS_id_seq', 1, false);
SELECT pg_catalog.setval('public."userS_id_seq"', 1, false);


--
Expand Down

0 comments on commit 885e234

Please sign in to comment.