0.17.0
Merged PRs
doltgresql
- 1194: Fix SSP linker errors for Windows build
Pulling in thepg_query_go
library added a CGO dependency, and the Windows build requires the stack smash protection library to be linked in. Unix builds do not, because it's built into Clang. - 1183: Bug fix: Function variable reference substitution
In function bodies, when replacing variable names with variable reference IDs, we were replacing any text matching the variable name, which wasn't always correct. This new approach tokenizes the expression and replaces only the tokens that exactly match a known variable name. There is still at least one more edge case we can fix in a follow up. - 1177: Can now call created functions
This makes a simple change so that we're now able to call user-created functions. This is intended as a temporary measure, as we ultimately want functions to be tied to commits (similar to how sequences and types are currently handled). That also entails changing how function calls are altogether handled, so rather than doing the larger change now, this is a stop-gap so that we can continue making progress onCREATE FUNCTION
. - 1174: Parse CREATE FUNCTION into runnable functions
This implements parsing ofCREATE FUNCTION
into the same expected set of operations as the handcoded examples. This means that we are able to writeCREATE FUNCTION
statements that are runnable, and the interpreter is able to properly execute said functions.
At the moment, the function provider used in GMS does not allow for adding new functions, so the test is skipped. I've confirmed it does work though if we hack around the provider limitation. It's also worth noting that we have to rely on the newpg_analyze
package in order to handle PL/pgSQL. I attempted to add support within our parser, but the syntax conflicts with regular SQL syntax in ways that can't really be reconciled, so this was the only choice. - 1169: PL/pgSQL: Add support for the
ALIAS
statement
Adds support for the execution logic for theALIAS
statement in user defined functions. - 1158: Add an interpreter base for function creation
This adds the base of an interpreter, upon whichCREATE FUNCTION
andCREATE PROCEDURE
will convert their contents to. Only the interpreter portion is partially implemented, along with a temporary example function and accompanying test to ensure that it works.
The next major step is to add parsing support for all of the statements that we'll need, as they do not yet exist (hence why the temporary example function's operations were manually created, although the conversion should result in the same output). The last major step will be to convert from the PL/pgSQL code to the operations that our interpreter expects.
The original intention was to implement as much of this in GMS as possible, however for now, the bulk of it will exist in Doltgres as I couldn't quite reconcile the proper way to implement it there without diving more fully into MySQL'sCREATE FUNCTION
andCREATE PROCEDURE
support (rather than simply relying on memory). This is something that I'll revisit in a later PR, as I feel it'll be easier to do once I have a relatively complete implementation done in Doltgres.
Related PR: - 1157: Fixed several bugs related to column default expressions and generated columns
Fixes a parser bug that disallowed calling a function with no arguments.
Implements a missing form of the substring() function.
Diff includes #1154 - 1154: Env var to ignore all unsupported DDL operations / commands
- 1152: bug fix for column defaults with function values
Removed the GMS validateColumnDefaults rule in favor of our own, and also made it run on CreateTable statements (it wasn't before due to an oversight in a type assertion).
Also implemented the gen_random_uuid function. - 1145: use cockroach errors.Errorf for one-off errors
This PR changes all uses of fmt.Errorf() to use the equivalent cockroach library instead. This gives us stack traces for all errors constructed this way during testing and debugging. - 1143: Tests for various column default values
Bug fix for new tests in dolthub/go-mysql-server#2825 - 1120: Support for parsing VACUUM statements, as a no-op
- 1113: Implementing new methods from
servercfg.DoltgresConfig
Implements the newIsUserSpecified()
andSkipRootUserInitialization()
methods fromservercfg.DoltgresConfig
, added in dolthub/dolt#8690 - 1108: Wrap function expressions for generated columns in parens
- 1107: Created wrappers around Internal IDs for consistency and added an ID dispatch registry
Currently, anInternal
ID requires one to know the exact format for constructing an ID of a specific type. For example,Internal
table IDs have the following format:Not only would you need to know that this is the format, but when retrieving values, you'd have to make sure that you accessed index 0 for the schema, and index 1 for the table. This opens up a potential for hard-to-find bugs. Wrappers help with this. Internally, the wrappers will call index 0 or 1, but one now just calls[ Schema_Name, Table_Name ]
SchemaName()
orTableName()
. In addition, they don't need to know the format, callingNewInternalTable
gives you the parameters that you need.
Additionally, this adds a registry where schema elements may register callbacks to respond to ID changes. For example, rather than having a table column explicitly handle all locations that depend on the column, it instead broadcasts that the column has changed, and all locations that have registered for that broadcast will modify themselves. This helps with scaling, as Postgres is far more inter-dependent than MySQL/Dolt, and reduces the knowledge burden required by developers.
Currently it's only used by sequences in this PR, and that's primarily due to most actions being handed off to GMS and Doltgres having no record of them. For example, deleting a column is completely handled by GMS, but Doltgres needs to broadcast that the column was deleted. For now, the idea is to wrap all such nodes in a Doltgres node at the end of the analyzer step (inReplaceNode
), but I'm open to another idea since it essentially means we're making a wrapper for the majority of GMS nodes. That's a separate issue from this PR though. - 1103: Implemented a no-op node for statements that can be safely ignored
Used for OWNER ddl statements for now, and will extend to VACUUM next. - 1097: CliContext interface update. NoOp
Account for interface change in Dolt: dolthub/dolt#8708 - 1095: Better support for COPY FROM statements
This change makes it possible to load data into tables without the full set of columns specified. pg_dump will not include generated columns in its output.
Also fixes a bug for the load from file use case, which only supported CSV files before (now supports the same set of formats).