This commit takes the first of many steps towards supporting the full functionality required by #588 and #522.
Previously, Octo did not support ARRAY()
syntax, leading to breakage during the PGAdmin connection process (#588). This is now fixed so that this process can continue. Note that this implementation of arrays does not satisfy the requirements of #522, as only one form of array syntax is supported with these changes.
This was accomplished by creating new SqlArray
statement type and LP_ARRAY
logical plan type and adding logic for handling these new types to the various modules accordingly that recurse through the parse tree and logical plans. Similarly a new ARRAY
token was added to the parser and lexer, and a new array_constructor
rule was added to the parser.
To make the new syntax function, a new GetScalarOrArray
M helper routine was added to replace the previous GetScalar
helper function. The reason for this is that ARRAY()
is only used for handling subqueries, which is the same scenario in which GetScalar
is used. This required adding a new to_array
member to the LpExtraDetail
struct for use in tmpl_print_expression
, the caller of GetScalar
and now of GetScalarOrArray
.
Related to this, generate_physical_plan
was updated to conditionally omit setting stash_columns_in_keys
to TRUE
when processing an ARRAY()
call.
Additionally, the new ARRAY()
constructor syntax was added to the documentation. Similarly, a new tests/test_array_syntax.bats.in
test file was added to validate the behavior of the new syntax.
Note that a NullDereference
clang warning from the new array_STATEMENT
case in lp_generate_where.c
was added to tools/ci/clang_tidy_warnings-release.ref
as this case is guarded by asserts, but clang does not see this in release builds.
Finally, various outrefs were updated to account for the new GetScalarOrArray
helper function in plan names, as well the consolidation of various pg_*
functions and revision of the default PostgreSQL encoding mentioned below.
Various miscellaneous fixes and enhancements were also made:
- Added loop to
handle_query.c
to allow for handling ofQuery
messages containing multiple queries (previously only the first query would be processed) - Added
current_database
,pg_encoding_to_char
,pg_is_in_recovery
,pg_is_xlog_replay_paused
, andhas_database_privilege
SQL functions to seed data (needed for PGAdmin startup process) - Changed default PostgreSQL encoding to ASCII for compatibility with PGAdmin defaults (Note: the is the default encoding in PostgreSQL. This change caused no breakage, so it's not clear why UTF-8 was chosen previously).
- Stubbed out
pg_settings
,pg_database
,pg_roles
, andpg_user
tables inocto-seed.sql
(needed for PGAdmin startup process) - Fixed formatting/style of comparison in
readline_get_more.c
- Consolidated
pg_catalog
functions into one new M file,_ydboctopgfunctions.m
, and removed previously scattered routines - Added new
OCTOLIT_ONEROWTABLE
to replace hardcoded literal - Revised lexer/parser to accept special functions without parenthesis in function calls and added these functions to the seed data and
_ydboctopgfunctions
- Updates to
handle_password_message
and related tests to issue valid (though unused by Octo) information to PGAdmin:- Store username on
%ydboctosession
for reference by various SQL user information functions - Omit
session_id
when storing username (inline comments explain this) - Revised callers of
handle_password_message
to omit session parameter
- Store username on
- Updated
pg_User
M routine to lookup username and added comment, so that this function actually returns information to PGAdmin (or other clients) - Added new
test_pgadmin.bats.in
test file to validate various changes related to PGAdmin support - [#435 (closed)] Removed useless parser rules for
SET
statements - Revised case of return value of
current_schema
function for consistency with uppercase identifiers - Removed now unneeded
__wrap_ydb_set_s
call in `test_handle_password_message - Added column name case conversion to Rocto row descriptions for compliance with PostgreSQL clients
- Updated various tests (
test_make_row_description
andtest_select_columns_psql.bats.in
) and outrefs accordingly
- Updated various tests (
- Moved
_ydboctopgTableIsVisible.m
and_ydboctopgGetUserbyid.m
routines into_ydboctopgfunctions.m
and updatedocto-seed.sql
accordingly - Updated
test_cancel_request.bats
to increase-global_buffers
to preventTRANS2BIG
failure inTCR03
- Updated
test_cancel_request.bats
to increase-global_buffers
to preventTRANS2BIG
failure inTCR03
- Added
CONCAT
function to docs - Added
TOLOWER
,TOUPPER
,TOUPPER_STR
, andTOLOWER_STR
macros to reduce duplication when converting between string cases - Revised find_column_alias_name to retrieve table_alias_STATEMENTs in case of array_STATEMENTs; updated outref
- Added sed conversion for session user in
TMU02
- Added more user friendly comment in case of build.sh failure outside of BATS tests
- Added omitted initialization of
use_valgrind
inbuild.sh
, which was previously uninitialized