From 829caa4fafb1cde8231e5bb0af78712c7211108b Mon Sep 17 00:00:00 2001 From: Dylan Chen Date: Wed, 25 Sep 2024 22:41:19 +0800 Subject: [PATCH 1/2] support pg_sequence --- e2e_test/batch/catalog/pg_sequence.slt.part | 4 +++ .../catalog/system_catalog/pg_catalog/mod.rs | 1 + .../system_catalog/pg_catalog/pg_sequence.rs | 31 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 e2e_test/batch/catalog/pg_sequence.slt.part create mode 100644 src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs diff --git a/e2e_test/batch/catalog/pg_sequence.slt.part b/e2e_test/batch/catalog/pg_sequence.slt.part new file mode 100644 index 0000000000000..4857693ff5781 --- /dev/null +++ b/e2e_test/batch/catalog/pg_sequence.slt.part @@ -0,0 +1,4 @@ +query ???????? +select seqrelid, seqtypid, seqstart, seqincrement, seqmax, seqmin, seqcache, seqcycle from pg_catalog.pg_sequence; +---- + diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs index 3d1c8f2a56f74..25fb0527cddf4 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs @@ -40,6 +40,7 @@ mod pg_proc; mod pg_range; mod pg_rewrite; mod pg_roles; +mod pg_sequence; mod pg_sequences; mod pg_settings; mod pg_shadow; diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs new file mode 100644 index 0000000000000..bea80db5981c8 --- /dev/null +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs @@ -0,0 +1,31 @@ +// Copyright 2024 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use risingwave_common::types::Fields; +use risingwave_frontend_macro::system_catalog; + +/// The catalog pg_sequence contains information about sequences. +/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-sequence.html`] +#[system_catalog(view, "pg_catalog.pg_sequence")] +#[derive(Fields)] +struct PgSequenceColumn { + seqrelid: i32, + seqtypid: i32, + seqstart: i64, + seqincrement: i64, + seqmax: i64, + seqmin: i64, + seqcache: i64, + seqcycle: bool, +} From c98c4ef0cf255149d299d8b4f6d22696391d1a49 Mon Sep 17 00:00:00 2001 From: Dylan Chen Date: Wed, 25 Sep 2024 23:24:38 +0800 Subject: [PATCH 2/2] fmt --- .../src/catalog/system_catalog/pg_catalog/pg_sequence.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs index bea80db5981c8..8fc9c4577adbb 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs @@ -15,7 +15,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; -/// The catalog pg_sequence contains information about sequences. +/// The catalog `pg_sequence` contains information about sequences. /// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-sequence.html`] #[system_catalog(view, "pg_catalog.pg_sequence")] #[derive(Fields)]