Skip to content

Commit

Permalink
feat: add missing fields of pg_attribute to satisfy pg server version…
Browse files Browse the repository at this point in the history
… 9.5 requirement by jdbc driver (#11182)
  • Loading branch information
yezizp2012 authored Jul 25, 2023
1 parent 35bed25 commit 43b7273
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@ SELECT current_setting('server_version');
query I
SELECT CAST(current_setting('server_version_num') AS INT) / 100 AS version;
----
803
905

query T
SELECT current_setting('rw_implicit_flush');
SELECT set_config('client_min_messages', 'warning', false);
----
false
warning

query T
SELECT set_config('rw_implicit_flush', 'true', false);
SELECT set_config('client_min_messages', 'notice', false);
----
true

query T
SELECT current_setting('rw_implicit_flush');
----
true
notice
2 changes: 1 addition & 1 deletion src/common/src/session_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ type IntervalStyle = ConfigString<INTERVAL_STYLE>;
type BatchParallelism = ConfigU64<BATCH_PARALLELISM, 0>;
type EnableJoinOrdering = ConfigBool<RW_ENABLE_JOIN_ORDERING, true>;
type ServerVersion = ConfigString<SERVER_VERSION>;
type ServerVersionNum = ConfigI32<SERVER_VERSION_NUM, 80_300>;
type ServerVersionNum = ConfigI32<SERVER_VERSION_NUM, 90_500>;
type ForceSplitDistinctAgg = ConfigBool<FORCE_SPLIT_DISTINCT_AGG, false>;
type ClientMinMessages = ConfigString<CLIENT_MIN_MESSAGES>;
type ClientEncoding = ConfigString<CLIENT_ENCODING>;
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ impl SysCatalogReaderImpl {
Some(ScalarImpl::Int16(index as i16 + 1)),
Some(ScalarImpl::Bool(false)),
Some(ScalarImpl::Bool(false)),
Some(ScalarImpl::Utf8("".into())),
Some(ScalarImpl::Utf8("".into())),
// From https://www.postgresql.org/docs/current/catalog-pg-attribute.html
// The value will generally be -1 for types that do not need
// `atttypmod`.
Expand All @@ -523,6 +525,8 @@ impl SysCatalogReaderImpl {
Some(ScalarImpl::Int16(index as i16 + 1)),
Some(ScalarImpl::Bool(false)),
Some(ScalarImpl::Bool(false)),
Some(ScalarImpl::Utf8("".into())),
Some(ScalarImpl::Utf8("".into())),
// From https://www.postgresql.org/docs/current/catalog-pg-attribute.html
// The value will generally be -1 for types that do not need
// `atttypmod`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ pub const PG_ATTRIBUTE_COLUMNS: &[SystemCatalogColumnsDef<'_>] = &[
(DataType::Int16, "attnum"),
(DataType::Boolean, "attnotnull"),
(DataType::Boolean, "attisdropped"),
(DataType::Varchar, "attidentity"),
(DataType::Varchar, "attgenerated"),
(DataType::Int32, "atttypmod"),
];

0 comments on commit 43b7273

Please sign in to comment.