-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat: pg_catalog.version(), standard_conforming_strings session var #2448
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import great_expectations as gx | ||
|
||
context = gx.get_context() # gets a great expectations project context | ||
ds = context.sources.add_postgres( | ||
name="glaredb", | ||
connection_string="postgresql://sean:sean@localhost:6543/db", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ pandas | |
polars | ||
pytest | ||
pandasai | ||
great_expectations[postgresql] | ||
great_expectations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ num-traits = "0.2.17" | |
dtoa = "1.0.9" | ||
chrono-tz = "0.8.5" | ||
bytes = "1.4.0" | ||
const_format = "0.2.32" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// Variables desribing the postgres version glaredb claims to be compatible with. | ||
use const_format::concatcp; | ||
|
||
pub const PG_MAJOR_VERSION: u16 = 15; | ||
pub const PG_MINOR_VERSION: u16 = 1; | ||
|
||
/// A short-form version string for use in the `server_version` session | ||
/// variable. | ||
pub const fn server_version() -> &'static str { | ||
concatcp!(PG_MAJOR_VERSION, ".", PG_MINOR_VERSION) | ||
} | ||
|
||
/// A long-form version string for use in the `pg_catalog.version()` function. | ||
/// | ||
/// Example: | ||
/// PostgreSQL 15.1 on aarch64-unknown-linux-gnu, compiled by rustc (GlareDB 0.8.1) | ||
pub const fn server_version_with_build_info() -> &'static str { | ||
// TODO: We should have a build_info crate with these constants. | ||
const GLAREDB_VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
const TARGET_TRIPLE: &str = "aarch64-unknown-linux-gnu"; // Again, build_info crate. | ||
|
||
concatcp!( | ||
"PostgreSQL ", | ||
server_version(), | ||
" on ", | ||
TARGET_TRIPLE, | ||
", compiled by rustc (GlareDB ", | ||
GLAREDB_VERSION, | ||
")" | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod compatible; | ||
pub mod error; | ||
pub mod format; | ||
pub mod notice; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
query B | ||
query T | ||
select starts_with(version(), 'v') | ||
---- | ||
t | ||
|
||
# There also exists a stub for pg_catalog.version(). This is hard coded to a | ||
# postgres version maximize compatability with postgres tooling, and is | ||
# _different_ than the `version()` function. | ||
# | ||
# Needed for great expections: <https://github.com/GlareDB/glaredb/issues/2436#issuecomment-1899383224> | ||
query T | ||
select starts_with(pg_catalog.version(), 'PostgreSQL 15.1') | ||
---- | ||
t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@universalmind303 I was originally trying to use
session_var("server_version")
here, but was getting a "Unknown variable: server_version" error.Using server_version here would be incorrect anyways, but where would I look to enable using it with
session_var
?