profile
viewpoint
Steven silathdiir Ru-by-st coder

Pragmatic-Elixir-Meetup/rpi-mmal-rs 3

Rust binding for `mmal` library of Raspberry Pi

Pragmatic-Elixir-Meetup/rpi-video-rs 3

Rust version of H264 video record on Raspberry Pi

silathdiir/rat_error 2

Elixir Helper functions for error handling

Pragmatic-Elixir-Meetup/rpi_video 1

Elixir version of H264 video record on Raspberry Pi

alex-dukhno/pg_wire 0

PostgreSQL Wire Protocol Backend Binaries

silathdiir/database 0

The core repository of implementing PostgreSQL compatible distributed database in Rust

silathdiir/gluesql 0

GlueSQL is quite sticky, it attaches to anywhere.

silathdiir/pg_wire 0

PostgreSQL Wire Protocol Backend Binaries

PR opened alex-dukhno/database

Implement Parameter Bind on SQL Where clause

Closes #275

Description

Implements Parameter Bind for simple expression on SQL Where clause as below.

prepare fooplan (smallint) as select * from schema_name.table_name where col1 = $1

Is it a feature that change user experience?

No

Client output

psql (12.1, server 0.0.0)
Type "help" for help.

xxx=> create schema schema_name;
CREATE SCHEMA
xxx=> create table schema_name.table_name (col1 smallint, col2 smallint, col3 smallint);
CREATE TABLE
xxx=> insert into schema_name.table_name values (1, 2, 3);
INSERT 0 1
xxx=> prepare fooplan (smallint) as select * from schema_name.table_name where col1 = $1;
PREPARE
xxx=> execute fooplan(1);
 col1 | col2 | col3
------+------+------
    1 |    2 |    3
(1 row)
+113 -31

0 comment

5 changed files

pr created time in a day

create barnchsilathdiir/database

branch : param-bind-for-select-where-clause

created branch time in a day

startedgreenplum-db/gpdb

started time in 3 days

delete branch silathdiir/pg_wire

delete branch : add-steven-to-authors

delete time in 3 days

PR opened alex-dukhno/pg_wire

Add Steven to authors field of Cargo.toml

No issue to close

Description

Adds Steven (me) to authors field of Cargo.toml.

+1 -1

0 comment

1 changed file

pr created time in 4 days

create barnchsilathdiir/pg_wire

branch : add-steven-to-authors

created branch time in 4 days

fork silathdiir/pg_wire

PostgreSQL Wire Protocol Backend Binaries

fork in 4 days

startedEmbarkStudios/rust-gpu

started time in 4 days

push eventsilathdiir/database

Alex Dukhno

commit sha 842b05a58d92bb106e5c5ae185adaf9d3c366e95

Extract pg model (#394)

view details

Alex Dukhno

commit sha de2b2e9c02773a9a5d7bc3fcae8b8c1f7f1adee1

remove serial types support (#395)

view details

push time in 5 days

push eventsilathdiir/database

Alex Dukhno

commit sha 5830df3a7d9085fce32af395cc5f5775498f5c17

minimising protocol code size and dependencies (#393)

view details

push time in 8 days

push eventsilathdiir/database

Steven

commit sha 89172770fb8f18768ac582e378768ef2ddb3527d

Fixes to combine async_dup Arc and Mutex to avoid thread issue in test. (#392)

view details

push time in 10 days

delete branch silathdiir/database

delete branch : fix-protocol-secure-test-failures

delete time in 10 days

PR opened alex-dukhno/database

Fix to combine async_dup Arc and Mutex to avoid thread issue in test

Closes #370

Description

Fixes the field request and response of TestCase to type Arc<Mutex<Unblock<File>>>. And clones them directly in function clone.

Is it a feature that change user experience?

No

Client output

No

+12 -15

0 comment

2 changed files

pr created time in 10 days

create barnchsilathdiir/database

branch : fix-protocol-secure-test-failures

created branch time in 10 days

push eventsilathdiir/database

Alex Dukhno

commit sha ff7eb78cc09a58c07108b7e4a4507dfa5b1a94df

Implementing hand_shake phase as a state machine (#386)

view details

Alex Dukhno

commit sha 62abd9ea6bba3d98f8936f4292caa301189d5462

Simplify protocol hand shake state management (#387)

view details

Alex Dukhno

commit sha 055b4b95759b28740378c6ade915eec631ba90de

Reduce number of state for protocol hand shake (#388)

view details

Steven

commit sha 17988b25ac1be1b44919bd6b27f51fc1bcde2571

Implements SQL statement Prepare, Execute and Deallocate (#385)

view details

Alex Dukhno

commit sha 1ab73db6b550cc8018ada8cc384f6869d628b573

Implements MessageDecoder as a state machine (#389)

view details

Alex Dukhno

commit sha 7e569f8dcb9307e34faecf77655d1409dd132008

addition to message decoder state (#390)

view details

push time in 11 days

issue commentalex-dukhno/database

Support Parameter Bind for simple expression on SQL Where clause

Hi @alex-dukhno , please assign this issue to me. Thanks.

silathdiir

comment created time in 11 days

delete branch silathdiir/database

delete branch : impl-sql-prepare-execute-and-deallocate

delete time in 12 days

push eventsilathdiir/database

Alex Dukhno

commit sha ff7eb78cc09a58c07108b7e4a4507dfa5b1a94df

Implementing hand_shake phase as a state machine (#386)

view details

Alex Dukhno

commit sha 62abd9ea6bba3d98f8936f4292caa301189d5462

Simplify protocol hand shake state management (#387)

view details

Alex Dukhno

commit sha 055b4b95759b28740378c6ade915eec631ba90de

Reduce number of state for protocol hand shake (#388)

view details

Steven Gu

commit sha a2aace6580bdace7a8faff26f771f559b42fe217

Implements SQL statement Prepare, Execute and Deallocate as part of Prepared Statement feature.

view details

Steven Gu

commit sha cf82a9dcf6dae46c647f8633b4d144b4b6c51aa2

Creates Cargo module pg_model to contain pg_types, and Cargo module protocol and node depend on pg_model.

view details

push time in 12 days

pull request commentalex-dukhno/database

Implements SQL statement Prepare, Execute and Deallocate

OK, I see. I will try to move src/protocol/src/pgsql_types.rs associating code to pg_model.

silathdiir

comment created time in 14 days

pull request commentalex-dukhno/database

Implements SQL statement Prepare, Execute and Deallocate

Hi @alex-dukhno , please help review this PR if you have time. Thanks.

silathdiir

comment created time in 14 days

PR opened alex-dukhno/database

Implements SQL statement Prepare, Execute and Deallocate

Closes #278

Description

Implements SQL statement Prepare, Execute and Deallocate as part of Prepared Statement feature.

Is it a feature that change user experience?

No

Client output

psql (12.1, server 0.0.0)
Type "help" for help.

xxx=> create schema schema_name;
CREATE SCHEMA
xxx=> create table schema_name.table_name (col1 smallint, col2 smallint, col3 smallint);
CREATE TABLE
xxx=> prepare fooplan (smallint, smallint) as insert into schema_name.table_name values ($1, $2, $3);
PREPARE
xxx=> execute fooplan(1, 2, 3);
INSERT 0 1
xxx=> deallocate fooplan;
DEALLOCATE
xxx=> select * from schema_name.table_name;
 col1 | col2 | col3
------+------+------
    1 |    2 |    3
(1 row)
+528 -151

0 comment

10 changed files

pr created time in 14 days

create barnchsilathdiir/database

branch : impl-sql-prepare-execute-and-deallocate

created branch time in 14 days

push eventsilathdiir/database

Steven

commit sha 1776a5c2b8a1adb762cd8644b7a9571f374143ff

Fix the issue of reporting UnexpectedEof when client disconnected immediately (#368)

view details

Alex Dukhno

commit sha 4240118c1f17ff2392560ae9a8c1051ff352f21c

remove protocol dependency from expr_eval (#369)

view details

Alex Dukhno

commit sha 6ed8c1150123f58bcd399d9730fd80a6aafe5ac4

remove protocol dependency from query planner (#371)

view details

Alex Dukhno

commit sha 03e4d31fe09aba44f17a5d73785460f23a043789

implement MetadataView for DataDefinition (#374)

view details

Alex Dukhno

commit sha 8d6fee5d6a71e42eb822221b643b9623c49a31c7

introduce describtion flow for insert statement (#375)

view details

push time in 18 days

issue commentalex-dukhno/database

Protocol Secure Flow Tests failures

I found the same issue yesterday in PR #368 . It seems that it is related with Cargo.lock update when running cargo update for all packages. So I only updated native-tls in PR #368 .

alex-dukhno

comment created time in 20 days

delete branch silathdiir/database

delete branch : fix-client-disconnected-immediately-issue

delete time in 21 days

push eventsilathdiir/database

Steven Gu

commit sha 354fc4fe5cea7651d571b727e402865a51457647

Updates dependency `native-tls` to fix `cargo-deny` crash issue.

view details

push time in 21 days

push eventsilathdiir/database

Steven Gu

commit sha 074b4561dfafa8fd48fbfb4570ef812e94de4503

Fixes the issue of reporting UnexpectedEof when client disconnected immediately without sending a Terminate message.

view details

Steven Gu

commit sha 49fc580e8d1ae721ffd10bb7c316121a1bea5cfa

Updates `Cargo.lock` to fix `cargo-deny` crash issue.

view details

push time in 21 days

push eventsilathdiir/database

Steven Gu

commit sha da92d764d176273e140bb82a505c79fb17bb1a0a

Updates `Cargo.lock` to fix `cargo-deny` crash issue.

view details

push time in 21 days

push eventsilathdiir/database

Steven Gu

commit sha d48e8b744b43d9f4d8958a3e9382c6c31f847b46

Fixes the issue of reporting UnexpectedEof when client disconnected immediately without sending a Terminate message.

view details

push time in 21 days

push eventsilathdiir/gluesql

Steven Gu

commit sha ca97ac7fbf1a808a4bec5886c22e63c402f01941

Reports an error for inserting more values than table columns.

view details

Taehoon Moon

commit sha 7cd08a81e364cdaf8483dee0a759ef7874995c63

Merge pull request #89 from silathdiir/report-error-for-insert-more-values Report an error for inserting more values than table columns

view details

push time in 21 days

pull request commentgluesql/gluesql

Report an error for inserting more values than table columns

Hi @panarch , thanks. I will try to test if it works.

I doubted that outside values has another mean (so I added the test case as below in this PR).

INSERT INTO TableA VALUES (100), (100, 200);

outside values = (100), (100, 200) inside values 1 = (100) inside values 2 = (100, 200)

I could not confirm that. Will test again. Thanks.

silathdiir

comment created time in 21 days

pull request commentalex-dukhno/database

Fix the issue of reporting UnexpectedEof when client disconnected immediately

Will try to figure out the failed cargo-deny.

silathdiir

comment created time in 21 days

push eventsilathdiir/database

Steven Gu

commit sha e627cf7e49306206c00cbfca9856b75be8b65467

Fixes the failed test cases.

view details

push time in 21 days

pull request commentalex-dukhno/database

Fix the issue of reporting UnexpectedEof when client disconnected immediately

Hi @alex-dukhno , please wait me to fix the test. Thanks.

silathdiir

comment created time in 21 days

PR opened alex-dukhno/database

Fix the issue of reporting UnexpectedEof when client disconnected immediately

Closes #354

Description

This issue occurred when client disconnected immediately without sending a Terminate message. As client closed the socket directly, the server side could only receive a zero byte for client close.

Is it a feature that change user experience?

no

Client output

This issue could be reproduced as @alex-dukhno 's comment in #354 when running compatibility tests, or run the below groovy script.

groovysh
groovy:000>

:grab org.postgresql:postgresql:9.4-1205-jdbc42
import groovy.sql.Sql

dbConf = [
  url: "jdbc:postgresql://localhost:5432/test?gssEncMode=disable&sslmode=disable&preferQueryMode=extendedForPrepared",
  user: "postgres",
  password: "postgres",
  driver: "org.postgresql.Driver",
]

db = Sql.newInstance(dbConf)

Then exit directly as below (or CTRL + C) without calling db.close().

groovy:000>:exit

The log message [protocol] client disconnected immediately should be displayed with this fix.

+22 -7

0 comment

1 changed file

pr created time in 21 days

create barnchsilathdiir/database

branch : fix-client-disconnected-immediately-issue

created branch time in 21 days

push eventsilathdiir/database

Alex Dukhno

commit sha f6f58ec72f1e6057ebba9185d1ab489f096650c9

extracting metadata and storage from data_manager (#365)

view details

push time in 22 days

push eventsilathdiir/database

dependabot[bot]

commit sha fd4f5e696dd2a7fe7cee0fe88ee5b15c0cf57a57

Bump smol from 1.2.2 to 1.2.3 (#362) Bumps [smol](https://github.com/stjepang/smol) from 1.2.2 to 1.2.3. - [Release notes](https://github.com/stjepang/smol/releases) - [Changelog](https://github.com/stjepang/smol/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/smol/compare/v1.2.2...v1.2.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha a427b122973310d0c7c99ea91fe5749ca746c946

Bump futures-lite from 1.8.0 to 1.10.0 (#359) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 1.8.0 to 1.10.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v1.8.0...v1.10.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 54c25dd305b779e4f3a636cde03f8cc6e7e133cd

Bump async-io from 1.1.6 to 1.1.9 (#361) Bumps [async-io](https://github.com/stjepang/async-io) from 1.1.6 to 1.1.9. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v1.1.6...v1.1.9) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

push time in 23 days

delete branch silathdiir/gluesql

delete branch : report-error-for-insert-more-values

delete time in 24 days

startedrust-lang/wg-async-foundations

started time in 25 days

PR opened gluesql/gluesql

Report an error for inserting more values than table columns

Closes #62 .

Fixes to report an error TooManyValues if inserting more values than target columns of the specified table.

+11 -0

0 comment

2 changed files

pr created time in 25 days

create barnchsilathdiir/gluesql

branch : report-error-for-insert-more-values

created branch time in 25 days

issue commentalex-dukhno/database

If PGJDBC does not close connection it crashes database on next connection

Hi @alex-dukhno , I tried to reproduce the above issue in groovysh (as below). I could not find the error log UNEXPECTED ERROR: Kind(UnexpectedEof).

groovysh
groovy:000>

:grab org.postgresql:postgresql:9.4-1205-jdbc42
import groovy.sql.Sql

dbConf = [
  url: "jdbc:postgresql://localhost:5432/test?gssEncMode=disable&sslmode=disable&preferQueryMode=extendedForPrepared",
  user: "postgres",
  password: "postgres",
  driver: "org.postgresql.Driver",
]

db = Sql.newInstance(dbConf)
db.execute 'create schema SCHEMA_NAME'
db.execute 'insert into SCHEMA_NAME.TABLE_NAME values (1, 2, 3), (4, 5, 6), (7, 8, 9)'

db = Sql.newInstance(dbConf())
db.execute 'select * from SCHEMA_NAME.TABLE_NAME'

But it seems that Schema cannot been created via Extended Query.

DEBUG [sqlparser::parser] Parsing sql 'create schema SCHEMA_NAME'...
DEBUG [data_manager::data_definition] checking schema existence "public"."schema_name"
ERROR [node::query_engine] Error while planning not supported extended query for CreateSchema(SchemaCreationInfo { schema_name: "schema_name" })

I tried with psql. It seems that UnexpectedEof occurred when starting with command psql -h localhost (without -W).

psql -h localhost

DEBUG [protocol] address V4(127.0.0.1:52256)
DEBUG [protocol] client is trying to connect with SSL
DEBUG [protocol] client is trying to connect with version 3
DEBUG [protocol] client message response tag Err(Kind(UnexpectedEof))
DEBUG [protocol] waiting for authentication response
ERROR [node::node] IO error Kind(UnexpectedEof)
DEBUG [protocol] address V4(127.0.0.1:52258)

I think it should not be the same issue. Could you help describe the detail reproduced steps? I could try to fix it. Thanks.

alex-dukhno

comment created time in 25 days

push eventsilathdiir/database

Alex Dukhno

commit sha 4cb49f89c7e1d0ae0f03407f4bd26881c9db1b4f

migrate type specific queries to groovy compatibility tests (#357)

view details

Alex Dukhno

commit sha b47a21cddebfb59b09565e470d93901a775796d8

remove functional tests job (#358)

view details

push time in 25 days

push eventsilathdiir/database

Alex Dukhno

commit sha 8b9b41a375d88698bcff64f0233ed59cdcbaa9f3

experimental filter dataflow element (#349)

view details

Alex Dukhno

commit sha 5dd9f31c63c50b74537f72c8ac879d7fb4b204c0

improvements to compatibility tests (#351) * drop schema if exists * create schema if not exists * drop table if exists * create table if not exists

view details

Alex Dukhno

commit sha 966aab2d60640a6b0738b5b7629ed7835f86f4f7

setup compatibility ci (#353)

view details

Alex Dukhno

commit sha 85929a39f2978229368536af6d56ca5ab59a2599

migrate basic queries to groovy tests (#355)

view details

push time in a month

startedgluesql/gluesql-js

started time in a month

fork silathdiir/gluesql

GlueSQL is quite sticky, it attaches to anywhere.

fork in a month

issue commentalex-dukhno/database

Implement SQL statements Prepare, Execute and Deallocate

Hi @alex-dukhno , please assign this issue to me. I could continue integrating these SQL statements with existing Prepared Statement feature.

silathdiir

comment created time in a month

push eventsilathdiir/database

Alex Dukhno

commit sha a9740f01fa7a102d53de23575c1e5fbb046729f7

ThoughtsGraph.xml

view details

Alex Dukhno

commit sha ea51c8f24f97df6d74efb260789576e3196dea64

Delete Untitled Diagram.xml

view details

Alex Dukhno

commit sha e30ed4f95fc3ed944b6318f2a67fb298dc265e5c

prepared statement refactoring (#333)

view details

Alex Dukhno

commit sha ba0bf62d9e0803e4631215b97de7fccf65252060

initial todo list (#334)

view details

Alex Dukhno

commit sha 87c137085d101a149fec890adb773793235d2a87

Extended query refactoring (#337)

view details

Alex Dukhno

commit sha c2c6a05773a4a3acf4b0dc56bcf93953eed9b2d8

query_executor executes Plan instead of Statement (#338)

view details

Alex Dukhno

commit sha 0fcc925a48639b35c5449855ec77a6a545d12573

prepare query_planner to use plan to create data flow (#347)

view details

Alex Dukhno

commit sha f6b7c73f366d76ee829e15d86ccd4bf4d7465ae5

update CHANGELOG.md for 0.1.4

view details

Alex Dukhno

commit sha 1ebe9de2968f8b7b6d2c30a12ec9d787eab57ea8

Update CHANGELOG.md

view details

Alex Dukhno

commit sha 2dedaf75ca57bd5e2ec9c72521abc4fd339ce2e9

single table dataflow based on iterator (#348)

view details

dependabot[bot]

commit sha c789436f6328f918d59396cef04bf0c1d7a59b48

Bump async-io from 1.1.2 to 1.1.5 (#342) Bumps [async-io](https://github.com/stjepang/async-io) from 1.1.2 to 1.1.5. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v1.1.2...v1.1.5) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 1f52b7915bdc0358e4002ae640ac193bc3708ee5

Bump smol from 1.0.0 to 1.2.2 (#340) * Bump smol from 1.0.0 to 1.2.2 Bumps [smol](https://github.com/stjepang/smol) from 1.0.0 to 1.2.2. - [Release notes](https://github.com/stjepang/smol/releases) - [Changelog](https://github.com/stjepang/smol/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/smol/compare/v1.0.0...v1.2.2) Signed-off-by: dependabot[bot] <support@github.com> * update deps Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Dukhno <alex.dukhno@icloud.com>

view details

Steven

commit sha b5f3664e712059063539a1997de220a39cc5de60

Implement query cancellation for PostgreSQL wire protocol (#341)

view details

push time in a month

delete branch silathdiir/database

delete branch : cancel-request-protocol

delete time in a month

pull request commentalex-dukhno/database

Implement query cancellation for PostgreSQL wire protocol

Hi @alex-dukhno , it seems that there is no branch update-dependecies in https://github.com/alex-dukhno/rust-native-tls.git. Could you help update https://github.com/alex-dukhno/async-native-tls/blob/new-native-tls/Cargo.toml#L18.

silathdiir

comment created time in a month

push eventsilathdiir/database

Steven Gu

commit sha f5c4b34265bd3ce1098c96e7cb1a57867929a500

Updates `Cargo.lock`.

view details

push time in a month

push eventsilathdiir/database

Steven Gu

commit sha 93be80293248025316ba486deca662dba6714ffe

Renames protocol function `hand_shake` to `accept_client_request`, and returns an Enum `ClientRequest` for Query connection and cancellation.

view details

push time in a month

push eventsilathdiir/database

Alex Dukhno

commit sha 0fcc925a48639b35c5449855ec77a6a545d12573

prepare query_planner to use plan to create data flow (#347)

view details

Alex Dukhno

commit sha f6b7c73f366d76ee829e15d86ccd4bf4d7465ae5

update CHANGELOG.md for 0.1.4

view details

Alex Dukhno

commit sha 1ebe9de2968f8b7b6d2c30a12ec9d787eab57ea8

Update CHANGELOG.md

view details

Alex Dukhno

commit sha 2dedaf75ca57bd5e2ec9c72521abc4fd339ce2e9

single table dataflow based on iterator (#348)

view details

dependabot[bot]

commit sha c789436f6328f918d59396cef04bf0c1d7a59b48

Bump async-io from 1.1.2 to 1.1.5 (#342) Bumps [async-io](https://github.com/stjepang/async-io) from 1.1.2 to 1.1.5. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v1.1.2...v1.1.5) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 1f52b7915bdc0358e4002ae640ac193bc3708ee5

Bump smol from 1.0.0 to 1.2.2 (#340) * Bump smol from 1.0.0 to 1.2.2 Bumps [smol](https://github.com/stjepang/smol) from 1.0.0 to 1.2.2. - [Release notes](https://github.com/stjepang/smol/releases) - [Changelog](https://github.com/stjepang/smol/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/smol/compare/v1.0.0...v1.2.2) Signed-off-by: dependabot[bot] <support@github.com> * update deps Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Dukhno <alex.dukhno@icloud.com>

view details

Steven Gu

commit sha f7afd6b0b9ea4254f8c3b31becfde90488cf71aa

Implements query cancellation for PostgreSQL wire protocol.

view details

Steven Gu

commit sha 4bfc95af793d8e0d827973b35b0fe981b2c77565

Renames protocol function `hand_shake` to `accept_client_request`, and returns an Enum `ClientRequest` for Query connection and cancellation.

view details

push time in a month

push eventsilathdiir/database

Steven Gu

commit sha f340f7f68bd17024b0840c882da2420fbcada7ea

Renames protocol function `hand_shake` to `accept_client_request`, and returns an Enum `ClientRequest` for Query connection and cancellation.

view details

push time in a month

startedgluesql/gluesql

started time in a month

pull request commentalex-dukhno/database

Implement query cancellation for PostgreSQL wire protocol

@alex-dukhno Please help review this PR if you have time. Thanks.

silathdiir

comment created time in a month

PR opened alex-dukhno/database

Implement query cancellation for PostgreSQL wire protocol

Implements the Protocol part of #207.

Description

This PR only implements the Protocol of CancelRequest. In-progress query cancellation hasn't been implemented yet.

  1. Adds struct ConnSupervisor to save the all current active connection pairs - conn_id and secret_key. The secret_key needs to be verified when invoking CancelRequest from another new connection.

  2. Returns conn_id and secret_key in backend message BackendKeyData (before ReadyForQuery) when startup.

Client output

Since the in-progress query cancellation hasn't been supported, the Empty cancellation could only been tested via psycopg2 (in python command line).

ipython

In [1]: from psycopg2 import connect

In [2]: conn = connect(host="localhost", password="check_this_out", database="postgres")

In [3]: conn.cancel()

The Debug log outputs as below.

$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/debug/database`

DEBUG [protocol] address V4(127.0.0.1:62276)
DEBUG [protocol] client is trying to connect with SSL
DEBUG [protocol] client is trying to connect with version 3
DEBUG [protocol] client message response tag Ok(112)
DEBUG [protocol] waiting for authentication response
DEBUG [protocol] start service on connection-1
DEBUG [protocol] send ready_for_query message
DEBUG [node::node] ready to handle query
DEBUG [protocol] address V4(127.0.0.1:62277)
DEBUG [protocol] client is trying to connect cancel request
DEBUG [node::node] cancel request of connection-1
+253 -19

0 comment

8 changed files

pr created time in a month

push eventsilathdiir/database

Steven Gu

commit sha 894a3df38f8221cdb4f705fd6604b51cf54c5865

Implements query cancellation for PostgreSQL wire protocol.

view details

push time in a month

push eventsilathdiir/database

Steven Gu

commit sha 3976ffdf0b816c558de64e0b9b5ad93934d77909

Implements query cancellation for PostgreSQL wire protocol.

view details

push time in a month

push eventsilathdiir/database

Alex Dukhno

commit sha a9740f01fa7a102d53de23575c1e5fbb046729f7

ThoughtsGraph.xml

view details

Alex Dukhno

commit sha ea51c8f24f97df6d74efb260789576e3196dea64

Delete Untitled Diagram.xml

view details

Alex Dukhno

commit sha e30ed4f95fc3ed944b6318f2a67fb298dc265e5c

prepared statement refactoring (#333)

view details

Alex Dukhno

commit sha ba0bf62d9e0803e4631215b97de7fccf65252060

initial todo list (#334)

view details

Alex Dukhno

commit sha 87c137085d101a149fec890adb773793235d2a87

Extended query refactoring (#337)

view details

Alex Dukhno

commit sha c2c6a05773a4a3acf4b0dc56bcf93953eed9b2d8

query_executor executes Plan instead of Statement (#338)

view details

Steven Gu

commit sha 236dc4fe62c768c0e3993de6c470e9fd47132a81

Implements query cancellation for PostgreSQL wire protocol.

view details

push time in a month

startedlaunchbadge/sqlx

started time in a month

push eventsilathdiir/database

dependabot[bot]

commit sha a855510419b58b9f86e0d0e7083a758c88373926

Bump futures-lite from 1.6.0 to 1.7.0 (#325) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v1.6.0...v1.7.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

Alex Dukhno

commit sha 029af87d6e654fd1eb9b902e4853346d42d0d1a5

add docs and compatibility tests (#326)

view details

Alex Dukhno

commit sha 49ad23831fca571af52f1584acbf62b05daac637

QueryEvent maps to single BackendMessage (#328)

view details

Steven Gu

commit sha e6e445249a4ba61dc8fa01b83012382f98dbe3bc

Implements query cancellation for PostgreSQL wire protocol.

view details

push time in a month

push eventsilathdiir/database

dependabot[bot]

commit sha a855510419b58b9f86e0d0e7083a758c88373926

Bump futures-lite from 1.6.0 to 1.7.0 (#325) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v1.6.0...v1.7.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

Alex Dukhno

commit sha 029af87d6e654fd1eb9b902e4853346d42d0d1a5

add docs and compatibility tests (#326)

view details

Alex Dukhno

commit sha 49ad23831fca571af52f1584acbf62b05daac637

QueryEvent maps to single BackendMessage (#328)

view details

push time in a month

delete branch silathdiir/database

delete branch : tls-conn-support

delete time in a month

create barnchsilathdiir/database

branch : cancel-request-protocol

created branch time in a month

push eventsilathdiir/database

Alex Dukhno

commit sha 685fb286ea5c0adfab87653713c2b5b9fe61eba3

groovy spock gradle based compatibility tests setup (#324)

view details

dependabot[bot]

commit sha e12c938b4d2c78abc613350e58ac94a08d3b3cda

Bump futures-lite from 1.4.0 to 1.6.0 (#322) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 1.4.0 to 1.6.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v1.4.0...v1.6.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 60b56c7fa06bd70a48cd97dab3c5b0e9209b66b8

Bump async-io from 1.0.2 to 1.1.2 (#323) Bumps [async-io](https://github.com/stjepang/async-io) from 1.0.2 to 1.1.2. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v1.0.2...v1.1.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

push time in a month

push eventsilathdiir/database

Alex Dukhno

commit sha dd6d413ff1a5d19b79ef5a91cabe3fe2a6ee5ae4

type constraints validate ScalarValue and return valid Datum (#316)

view details

Alex Dukhno

commit sha 35d60921a4a295b1b292cca6dcdcaa999d583311

delete unused code in Datum (#318)

view details

push time in a month

push eventsilathdiir/database

Alex Dukhno

commit sha 2ec76aa258bdda6455079a604bc6d7d76eeefe6a

align update and insert queries planning and execution (#308) * introduce ast module * introduce expr_eval module

view details

Alex Dukhno

commit sha 7a014f023f8f3cd4dfc2bc128ce2634189024b51

implicit type casting (#312)

view details

Alex Dukhno

commit sha a4fe89ec04507b34df02bc1e4dabcf659862f04a

dynamic expression evaluates to ScalarOp instead of Datum (#314)

view details

Alex Dukhno

commit sha cce51ad90f82218683a70e6963fbadd4e60c6b99

fix regression when same column name occurs multiple times in insert and update assignments (#315)

view details

push time in 2 months

push eventsilathdiir/database

dependabot[bot]

commit sha 59d8dd053712b6908dd9620b0fba9d948efbf5ab

Bump sled from 0.34.3 to 0.34.4 (#309) Bumps [sled](https://github.com/spacejam/sled) from 0.34.3 to 0.34.4. - [Release notes](https://github.com/spacejam/sled/releases) - [Changelog](https://github.com/spacejam/sled/blob/master/CHANGELOG.md) - [Commits](https://github.com/spacejam/sled/compare/v0.34.3...v0.34.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

push time in 2 months

push eventsilathdiir/database

dependabot[bot]

commit sha e32b28b871174c9e54d24e87c849fcc0adb7c5af

Bump async-io from 1.0.1 to 1.0.2 (#307) Bumps [async-io](https://github.com/stjepang/async-io) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v1.0.1...v1.0.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 926472a3b9b58ed530dbde6dec74d4d936bd516b

Bump futures-lite from 1.3.0 to 1.4.0 (#306) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 1.3.0 to 1.4.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v1.3.0...v1.4.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

push time in 2 months

startedmingrammer/diagrams

started time in 2 months

push eventsilathdiir/database

Alex Dukhno

commit sha 165598cca805efa6a83ff42b84ee02b16fc2f429

Refactor query planner (#298)

view details

Alex Dukhno

commit sha 1c7b4358624ccaa6ae29a4d1613d8604b2502c50

introduce query_planner unit tests (#299)

view details

dependabot[bot]

commit sha 67f62bf6c6b2726da2a7fa81c0829ce0667de333

Bump blocking from 0.6.1 to 1.0.0 (#303) Bumps [blocking](https://github.com/stjepang/blocking) from 0.6.1 to 1.0.0. - [Release notes](https://github.com/stjepang/blocking/releases) - [Changelog](https://github.com/stjepang/blocking/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/blocking/compare/v0.6.1...v1.0.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha e6627ebde954d0bd4332196d1fb2128cfac0e6ce

Bump futures-lite from 1.2.0 to 1.3.0 (#301) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 1.2.0 to 1.3.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v1.2.0...v1.3.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 877aefef359ea3537866adf3d1fef29541e68dae

Bump async-mutex from 1.2.0 to 1.3.0 (#302) Bumps [async-mutex](https://github.com/stjepang/async-mutex) from 1.2.0 to 1.3.0. - [Release notes](https://github.com/stjepang/async-mutex/releases) - [Changelog](https://github.com/stjepang/async-mutex/blob/v1.3.0/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-mutex/compare/v1.2.0...v1.3.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Dukhno <5074607+alex-dukhno@users.noreply.github.com>

view details

dependabot[bot]

commit sha aa787db0b7a13f76c645f9fd3c13615bea3747bf

Bump async-io from 0.2.7 to 1.0.1 (#300) * Bump async-io from 0.2.7 to 1.0.1 Bumps [async-io](https://github.com/stjepang/async-io) from 0.2.7 to 1.0.1. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v0.2.7...v1.0.1) Signed-off-by: dependabot[bot] <support@github.com> * update smol * update deps Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Dukhno <alex.dukhno@icloud.com>

view details

Alex Dukhno

commit sha 3098a0b62f0a76e4e93fe7781764d291c82ad5a7

generalise cross module apis (#304)

view details

push time in 2 months

push eventsilathdiir/database

Steven

commit sha 0a07810fcf1c5d92d93c7847fa375747dd075e34

Fixes to always return QueryComplete after an ErrorResponse for Simple Query. (#296)

view details

Andrew Bregger

commit sha 89703d50ef111ce8bcb374a5a272a9b26f8afbf3

converted SchemaId and TableId to use RecordId instead of strings. (#291)

view details

dependabot[bot]

commit sha ceda1397a8c7766a6cdb6b37a9dbc4e66e033448

Bump futures-lite from 1.0.0 to 1.2.0 (#297) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 1.0.0 to 1.2.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v1.0.0...v1.2.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

push time in 2 months

delete branch silathdiir/database

delete branch : fix-to-respond-query-complete-after-err

delete time in 2 months

push eventsilathdiir/database

Steven Gu

commit sha 4082465f853407ed228091839900832188543255

Fixes to always return QueryComplete after an ErrorResponse for Simple Query.

view details

push time in 2 months

PR opened alex-dukhno/database

Fix to always return ReadyForQuery after an ErrorResponse

Description

As @alex-dukhno mentioned, psql is stuck after inputting wrong SQL syntax (as selec * from table).

Fixes to always return ReadyForQuery message (as QueryEvent::QueryComplete) after both CommandComplete or ErrorResponse messages. I missed to return ReadyForQuery after ErrorResponse before.

Client output

After adding this fix, the psql could display the error message without stuck.

psql (12.1, server 0.0.0)
Type "help" for help.

xxx=> selec * from table;
ERROR:  syntax error in "selec * from table;" can't be parsed
+37 -5

0 comment

3 changed files

pr created time in 2 months

create barnchsilathdiir/database

branch : fix-to-respond-query-complete-after-err

created branch time in 2 months

push eventsilathdiir/database

Alex Dukhno

commit sha fb774c908bcc8fa2c3f2d58b0800778c8b25fc5d

minimal select migration to query planner (#294)

view details

Alex Dukhno

commit sha 841d7835df757b132b05591bfbae8920d74a606f

extract query planner module (#295)

view details

push time in 2 months

push eventsilathdiir/database

Alex Dukhno

commit sha 46491e26c0d04a6268cb754294bbfb5286ae202f

implement drop schema cascade (#253)

view details

Alex Dukhno

commit sha 100d970523861f7bb2f7515e6e89f93617cddff8

persistence path for docker container to store data (#257)

view details

Alex Dukhno

commit sha 3108a03c7e3bb199836634716a283c5fda3d11e5

improve testing over storage module (#259)

view details

Alex Dukhno

commit sha 8763feea0b50982a6b5ca27c5403302695ce2868

updated change log for 0.1.3 version (#260)

view details

Alex Dukhno

commit sha 0af004287561b5af39f81773fde6a15f967db52f

remove code duplication from persistent database (#261)

view details

Alex Dukhno

commit sha 72af8319cda32de80e6ccd514d21cd63423c38cf

added persistent catalog manager tests (#262)

view details

Alex Dukhno

commit sha b40f5719fac910cdbec13c3151c910dc52992753

make QueryError represent single error (#263)

view details

dependabot[bot]

commit sha 2a38abc3be0aa3d0593b97b1514227c0ef31f3bd

Bump async-mutex from 1.1.5 to 1.2.0 (#264) Bumps [async-mutex](https://github.com/stjepang/async-mutex) from 1.1.5 to 1.2.0. - [Release notes](https://github.com/stjepang/async-mutex/releases) - [Changelog](https://github.com/stjepang/async-mutex/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-mutex/compare/v1.1.5...v1.2.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 229485ae62b4b9533707fa8191dc7578bea06a9f

Bump async-trait from 0.1.38 to 0.1.40 (#266) Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.38 to 0.1.40. - [Release notes](https://github.com/dtolnay/async-trait/releases) - [Commits](https://github.com/dtolnay/async-trait/compare/0.1.38...0.1.40) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 330b959ed5fb397f8917531901f45888d0fe14cf

Bump futures-lite from 0.1.11 to 1.0.0 (#267) Bumps [futures-lite](https://github.com/stjepang/futures-lite) from 0.1.11 to 1.0.0. - [Release notes](https://github.com/stjepang/futures-lite/releases) - [Changelog](https://github.com/stjepang/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/futures-lite/compare/v0.1.11...v1.0.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

dependabot[bot]

commit sha 4212c8401b57bd48b3d674386456043ea636a40a

Bump async-net from 0.1.2 to 1.0.0 (#265) * Bump async-net from 0.1.2 to 1.0.0 Bumps [async-net](https://github.com/stjepang/async-net) from 0.1.2 to 1.0.0. - [Release notes](https://github.com/stjepang/async-net/releases) - [Changelog](https://github.com/stjepang/async-net/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-net/compare/v0.1.2...v1.0.0) Signed-off-by: dependabot[bot] <support@github.com> * update smol and async-net dependencies * fix clippy rustfmt Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Dukhno <alex.dukhno@icloud.com>

view details

Alex Dukhno

commit sha 4bbbf3b761a5f05e932a192cf3de2b4b27e712e5

Revert "Bump async-net from 0.1.2 to 1.0.0 (#265)" (#268) This reverts commit 4212c8401b57bd48b3d674386456043ea636a40a.

view details

Alex Dukhno

commit sha e7b1b54f85f048d92c4d139a47a7a20926e581bc

update to latest dependencies (#269)

view details

dependabot[bot]

commit sha 1eb9bf10ccd96a653386bb8e54e008e540e35ae9

Bump simple_logger from 1.7.0 to 1.9.0 (#271) * Bump simple_logger from 1.7.0 to 1.9.0 Bumps [simple_logger](https://github.com/borntyping/rust-simple_logger) from 1.7.0 to 1.9.0. - [Release notes](https://github.com/borntyping/rust-simple_logger/releases) - [Commits](https://github.com/borntyping/rust-simple_logger/compare/v1.7.0...v1.9.0) Signed-off-by: dependabot[bot] <support@github.com> * use builder for initialize logger Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Dukhno <alex.dukhno@icloud.com>

view details

Alex Dukhno

commit sha 234a2f21c593dcb0c2def52bca1f543a88c2a30e

refactor *Commands to use CatalogManager iteration 1 (#272)

view details

dependabot[bot]

commit sha 0671c517639da7c4d61576ec3df00920c97fbf95

Bump async-io from 0.2.6 to 0.2.7 (#273) Bumps [async-io](https://github.com/stjepang/async-io) from 0.2.6 to 0.2.7. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v0.2.6...v0.2.7) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

Alex Dukhno

commit sha 387d9a5015ff92fb48b1357b125f2adfaec47199

use match over table_exists function (#280)

view details

Steven

commit sha dd7bd55af00551e42684ee417ed4ae313fc16829

Implement Bind and Execute processes of Postgres Extended Query protocol (#274)

view details

Alex Dukhno

commit sha 55934b8cfa1dca83717e45be60c4297c6a5f7d12

drop shema by id (#281)

view details

Alex Dukhno

commit sha 6355f8370d77b5bb1e743cb5276f62e1b86ad831

create table with schema (#282)

view details

push time in 2 months

issue commentalex-dukhno/database

Implement query cancelation for PostgreSQL wire protocol

Hi @alex-dukhno , please assign this issue to me. I will back to work on Prepared Statement on Simple Query after finishing this one and no others want to fix #278 .

alex-dukhno

comment created time in 2 months

delete branch silathdiir/database

delete branch : implement-extend-query-bind-and-execute-processes

delete time in 2 months

pull request commentalex-dukhno/database

Implement Bind and Execute processes of Postgres Extended Query protocol

Hi @alex-dukhno , I fixes the issues you mentioned in the code review. I list the fixes to avoid missing.

  1. Fixes enum Commands to have name fields (as FrontendMessage).

  2. Moves decode and parse functions from sql_values.rs to sql_types.rs as funtions of PostgreSqlType.

  3. Removes the one byte limitation of Char(n) SQL type.

And I also merge the file src/sql_engine/src/dml/select.rs manually, please help check and review the fixes, and point out if I missed some ones. Thanks.

silathdiir

comment created time in 2 months

push eventsilathdiir/database

dependabot[bot]

commit sha 0671c517639da7c4d61576ec3df00920c97fbf95

Bump async-io from 0.2.6 to 0.2.7 (#273) Bumps [async-io](https://github.com/stjepang/async-io) from 0.2.6 to 0.2.7. - [Release notes](https://github.com/stjepang/async-io/releases) - [Changelog](https://github.com/stjepang/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/stjepang/async-io/compare/v0.2.6...v0.2.7) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

Alex Dukhno

commit sha 387d9a5015ff92fb48b1357b125f2adfaec47199

use match over table_exists function (#280)

view details

Steven Gu

commit sha c01b4710355918fb6ca3e29d21f4abd7f8d47ecf

Implements Bind and Execute processes of Extended Query protocol. So the main features of Postgres Extended Query protocol have been supported for now.

view details

Steven Gu

commit sha 7743faf5036324e4cf85e0b388d5629eb895435e

Fixes the issues according to the code review.

view details

push time in 2 months

push eventsilathdiir/database

Steven Gu

commit sha 599f4c6db4f711c2e1df8adbc614ca59a29d837c

Fixes the issues according to the code review.

view details

push time in 2 months

push eventsilathdiir/database

Steven Gu

commit sha eb5dbc3555930fc2bae360cbdfc9ede73f8831e7

Fixes the issues according to the code review.

view details

push time in 2 months

issue openedalex-dukhno/database

Implement SQL statements Prepare, Execute and Deallocate

The Postgres doc: https://www.postgresql.org/docs/current/sql-prepare.html#SQL-PREPARE-EXAMPLES .

The crate sqlparser-rs needs to be upgraded to include the PR: https://github.com/ballista-compute/sqlparser-rs/pull/243 .

These three statements should be considered as one part of Prepared Statement (another one is Extended Query), and should be implemented and integrated with the current implementation of Prepared Statement (in session).

It is used for Prepared Statement. You could get more information in PR #274 .

created time in 2 months

Pull request review commentalex-dukhno/database

Implement Bind and Execute processes of Postgres Extended Query protocol

+// Copyright 2020 Alex Dukhno+//+// 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 crate::{sql_formats::PostgreSqlFormat, sql_types::PostgreSqlType};+use byteorder::{BigEndian, ReadBytesExt};+use std::str;++type Result = std::result::Result<PostgreSqlValue, String>;++/// Represents PostgreSQL data values sent and received over wire+#[allow(missing_docs)]+#[derive(Clone, Debug, Eq, PartialEq)]+pub enum PostgreSqlValue {+    Null,+    True,+    False,+    Int16(i16),+    Int32(i32),+    Int64(i64),+    String(String),+}++impl PostgreSqlValue {+    /// Deserializes a value of type `typ` from `raw` using the specified+    /// `format`.+    pub fn decode(format: &PostgreSqlFormat, typ: &PostgreSqlType, raw: &[u8]) -> Result {+        match format {+            PostgreSqlFormat::Binary => decode_binary(typ, raw),+            PostgreSqlFormat::Text => decode_text(typ, raw),+        }+    }+}++fn decode_binary(typ: &PostgreSqlType, raw: &[u8]) -> Result {+    match typ {+        PostgreSqlType::Bool => parse_bool_from_binary(raw),+        PostgreSqlType::Char => parse_char_from_binary(raw),+        PostgreSqlType::VarChar => parse_varchar_from_binary(raw),+        PostgreSqlType::SmallInt => parse_smallint_from_binary(raw),+        PostgreSqlType::Integer => parse_integer_from_binary(raw),+        PostgreSqlType::BigInt => parse_bigint_from_binary(raw),+        other => Err(format!("Unsupported Postgres type: {:?}", other)),+    }+}++fn decode_text(typ: &PostgreSqlType, raw: &[u8]) -> Result {+    let s = match str::from_utf8(raw) {+        Ok(s) => s,+        Err(_) => return Err(format!("Failed to parse UTF8 from: {:?}", raw)),+    };++    match typ {+        PostgreSqlType::Bool => parse_bool_from_text(s),+        PostgreSqlType::Char => parse_char_from_text(s),+        PostgreSqlType::VarChar => parse_varchar_from_text(s),+        PostgreSqlType::SmallInt => parse_smallint_from_text(s),+        PostgreSqlType::Integer => parse_integer_from_text(s),+        PostgreSqlType::BigInt => parse_bigint_from_text(s),+        other => Err(format!("Unsupported Postgres type: {:?}", other)),+    }+}++fn parse_bigint_from_binary(mut buf: &[u8]) -> Result {+    let v = match buf.read_i64::<BigEndian>() {+        Ok(v) => v,+        Err(_) => return Err(format!("Failed to parse BigInt from: {:?}", buf)),+    };++    if !buf.is_empty() {+        return Err("invalid buffer size".into());+    }++    Ok(PostgreSqlValue::Int64(v))+}++fn parse_bigint_from_text(s: &str) -> Result {+    let v: i64 = match s.trim().parse() {+        Ok(v) => v,+        Err(_) => return Err(format!("Failed to parse SmallInt from: {}", s)),+    };++    Ok(PostgreSqlValue::Int64(v))+}++fn parse_bool_from_binary(buf: &[u8]) -> Result {+    let len = buf.len();+    if len != 1 {

Sorry. I mean just the SQL type Char. It is handled as a single byte when passing in binary (not as Varchar).

silathdiir

comment created time in 2 months

PullRequestReviewEvent

issue openedalex-dukhno/database

Handle parameter max_rows of Extended Query Protocol Execute

As mentioned in Postgres doc:

Once a portal exists, it can be executed using an Execute message. The Execute message specifies the portal name (empty string denotes the unnamed portal) and a maximum result-row count (zero meaning "fetch all rows"). The result-row count is only meaningful for portals containing commands that return row sets; in other cases the command is always executed to completion, and the row count is ignored.

We ignores this parameter and always return to completion for now.

The code example is implemented from materialize: https://github.com/MaterializeInc/materialize/blob/main/src/pgwire/src/protocol.rs#L549 .

created time in 2 months

Pull request review commentalex-dukhno/database

Implement Bind and Execute processes of Postgres Extended Query protocol

+// Copyright 2020 Alex Dukhno+//+// 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 crate::{sql_formats::PostgreSqlFormat, sql_types::PostgreSqlType};+use byteorder::{BigEndian, ReadBytesExt};+use std::str;++type Result = std::result::Result<PostgreSqlValue, String>;++/// Represents PostgreSQL data values sent and received over wire+#[allow(missing_docs)]+#[derive(Clone, Debug, Eq, PartialEq)]+pub enum PostgreSqlValue {+    Null,+    True,+    False,+    Int16(i16),+    Int32(i32),+    Int64(i64),+    String(String),+}++impl PostgreSqlValue {+    /// Deserializes a value of type `typ` from `raw` using the specified+    /// `format`.+    pub fn decode(format: &PostgreSqlFormat, typ: &PostgreSqlType, raw: &[u8]) -> Result {+        match format {+            PostgreSqlFormat::Binary => decode_binary(typ, raw),+            PostgreSqlFormat::Text => decode_text(typ, raw),+        }+    }+}++fn decode_binary(typ: &PostgreSqlType, raw: &[u8]) -> Result {+    match typ {+        PostgreSqlType::Bool => parse_bool_from_binary(raw),+        PostgreSqlType::Char => parse_char_from_binary(raw),+        PostgreSqlType::VarChar => parse_varchar_from_binary(raw),+        PostgreSqlType::SmallInt => parse_smallint_from_binary(raw),+        PostgreSqlType::Integer => parse_integer_from_binary(raw),+        PostgreSqlType::BigInt => parse_bigint_from_binary(raw),+        other => Err(format!("Unsupported Postgres type: {:?}", other)),+    }+}++fn decode_text(typ: &PostgreSqlType, raw: &[u8]) -> Result {+    let s = match str::from_utf8(raw) {+        Ok(s) => s,+        Err(_) => return Err(format!("Failed to parse UTF8 from: {:?}", raw)),+    };++    match typ {+        PostgreSqlType::Bool => parse_bool_from_text(s),+        PostgreSqlType::Char => parse_char_from_text(s),+        PostgreSqlType::VarChar => parse_varchar_from_text(s),+        PostgreSqlType::SmallInt => parse_smallint_from_text(s),+        PostgreSqlType::Integer => parse_integer_from_text(s),+        PostgreSqlType::BigInt => parse_bigint_from_text(s),+        other => Err(format!("Unsupported Postgres type: {:?}", other)),+    }+}++fn parse_bigint_from_binary(mut buf: &[u8]) -> Result {+    let v = match buf.read_i64::<BigEndian>() {+        Ok(v) => v,+        Err(_) => return Err(format!("Failed to parse BigInt from: {:?}", buf)),+    };++    if !buf.is_empty() {+        return Err("invalid buffer size".into());+    }++    Ok(PostgreSqlValue::Int64(v))+}++fn parse_bigint_from_text(s: &str) -> Result {+    let v: i64 = match s.trim().parse() {+        Ok(v) => v,+        Err(_) => return Err(format!("Failed to parse SmallInt from: {}", s)),+    };++    Ok(PostgreSqlValue::Int64(v))+}++fn parse_bool_from_binary(buf: &[u8]) -> Result {+    let len = buf.len();+    if len != 1 {

Is the type Char is handled as a single character?

https://github.com/sfackler/rust-postgres/blob/master/postgres-protocol/src/types/mod.rs#L75

silathdiir

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentalex-dukhno/database

Implement Bind and Execute processes of Postgres Extended Query protocol

+// Copyright 2020 Alex Dukhno+//+// 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 crate::{sql_formats::PostgreSqlFormat, sql_types::PostgreSqlType};+use byteorder::{BigEndian, ReadBytesExt};+use std::str;++type Result = std::result::Result<PostgreSqlValue, String>;++/// Represents PostgreSQL data values sent and received over wire+#[allow(missing_docs)]+#[derive(Clone, Debug, Eq, PartialEq)]+pub enum PostgreSqlValue {+    Null,+    True,+    False,+    Int16(i16),+    Int32(i32),+    Int64(i64),+    String(String),+}++impl PostgreSqlValue {+    /// Deserializes a value of type `typ` from `raw` using the specified+    /// `format`.+    pub fn decode(format: &PostgreSqlFormat, typ: &PostgreSqlType, raw: &[u8]) -> Result {+        match format {+            PostgreSqlFormat::Binary => decode_binary(typ, raw),+            PostgreSqlFormat::Text => decode_text(typ, raw),+        }+    }+}++fn decode_binary(typ: &PostgreSqlType, raw: &[u8]) -> Result {+    match typ {+        PostgreSqlType::Bool => parse_bool_from_binary(raw),+        PostgreSqlType::Char => parse_char_from_binary(raw),+        PostgreSqlType::VarChar => parse_varchar_from_binary(raw),+        PostgreSqlType::SmallInt => parse_smallint_from_binary(raw),+        PostgreSqlType::Integer => parse_integer_from_binary(raw),+        PostgreSqlType::BigInt => parse_bigint_from_binary(raw),+        other => Err(format!("Unsupported Postgres type: {:?}", other)),+    }+}++fn decode_text(typ: &PostgreSqlType, raw: &[u8]) -> Result {+    let s = match str::from_utf8(raw) {+        Ok(s) => s,+        Err(_) => return Err(format!("Failed to parse UTF8 from: {:?}", raw)),+    };++    match typ {+        PostgreSqlType::Bool => parse_bool_from_text(s),+        PostgreSqlType::Char => parse_char_from_text(s),+        PostgreSqlType::VarChar => parse_varchar_from_text(s),+        PostgreSqlType::SmallInt => parse_smallint_from_text(s),+        PostgreSqlType::Integer => parse_integer_from_text(s),+        PostgreSqlType::BigInt => parse_bigint_from_text(s),+        other => Err(format!("Unsupported Postgres type: {:?}", other)),+    }+}++fn parse_bigint_from_binary(mut buf: &[u8]) -> Result {+    let v = match buf.read_i64::<BigEndian>() {+        Ok(v) => v,+        Err(_) => return Err(format!("Failed to parse BigInt from: {:?}", buf)),+    };++    if !buf.is_empty() {+        return Err("invalid buffer size".into());+    }++    Ok(PostgreSqlValue::Int64(v))+}++fn parse_bigint_from_text(s: &str) -> Result {+    let v: i64 = match s.trim().parse() {+        Ok(v) => v,+        Err(_) => return Err(format!("Failed to parse SmallInt from: {}", s)),+    };++    Ok(PostgreSqlValue::Int64(v))+}++fn parse_bool_from_binary(buf: &[u8]) -> Result {+    let len = buf.len();+    if len != 1 {

I think passing type bool and char in binary should be validated the length of [u8] to one. I referenced the code of rust-postgres (which is used by materialize): https://github.com/sfackler/rust-postgres/blob/master/postgres-protocol/src/types/mod.rs#L34

silathdiir

comment created time in 2 months

PullRequestReviewEvent

issue openedalex-dukhno/database

Support Parameter Bind for complicated expressions

For binding parameters for complicated expressions as below.

select ($1 + column_1) from schema_name.table_name where column_2 > $2 * $3;

And there should be other more complicated recursive ones. Please review the function bind_parameters in materialize for details: https://github.com/MaterializeInc/materialize/blob/main/src/sql/src/plan/expr.rs#L693.

It is used for Prepared Statement. You could get more information in PR #274 .

created time in 2 months

issue commentalex-dukhno/database

Support Parameter Bind for simple expression on SQL Where clause

Hi @alex-dukhno , it seems that I could not add Labels (as T-Enhancement) on this issue. Please help add the labels. Thanks.

silathdiir

comment created time in 2 months

issue openedalex-dukhno/database

Support Parameter Bind for simple expression on SQL Where clause

For now only two SQL formats has been supported to bind parameters (as commented on src/sql_engine/src/query/bind.rs).

insert into schema_name.table_name values ($1, 1), ($2, 2);
update schema_name.table_name set col1 = $1, col2 = $2;

We need to implement binding on the SQL where clause, and support binding on statment Select and Delete as below.

update schema_name.table_name set col1 = $1, col2 = $2 where col1 = $3;
select * from schema_name.table_name where col1 = $1;
delete from schema_name.table_name where col1 = $1;

Only Simple Expr::Identifier should be handled in this issue. The binding for complicated expression should be handled in others.

The complicated expressions should not been handled in this issue as below.

select ($1 + column_1) from schema_name.table_name;

created time in 2 months

pull request commentalex-dukhno/database

Implement Bind and Execute processes of Postgres Extended Query protocol

Can you please create issue for that? You should have access to create enhancements. Thanks.

@alex-dukhno Sure, I will list and create issues for enhancements. Thanks.

silathdiir

comment created time in 2 months

pull request commentalex-dukhno/database

Implement Bind and Execute processes of Postgres Extended Query protocol

Hi @alex-dukhno, I got the information from this comment of materialize: https://github.com/MaterializeInc/materialize/blob/main/src/coord/src/session/statement.rs#L12.

For testing Prepared Statement via Simple Query on my local Mac, I started an instance via brew services start postgresql. Connects it via psql, and inputs the below commands.

=# create schema schema_name;
=# create table schema_name.table_name (s1 int, s2 int);
=# \d schema_name.table_name;

=# prepare prepared_stmt_name (int, int) as insert into schema_name.table_name values($1, $2);
=# execute prepared_stmt_name(1, 1);
=# select * from schema_name.table_name;

For further testing with git@github.com:epgsql/epgsql.git, it seems that Postgres could recognize and use Prepared Statement from both sources.

I create a Prepared Statement via Parse of Extended Query. And execute it by Simple Query as below (epgsql:squery("execute prepared_statement_name(1, 1)").

The only limitation is must invoking on the same session (Client socket C as below).

git clone git@github.com:epgsql/epgsql.git
cd epgsql
make

./rebar3 shell

1> {ok, C} = epgsql:connect("localhost", "user", "password", #{codecs => []}).
2> epgsql:squery(C, "create schema schema_name").
3> epgsql:squery(C, "create table schema_name.table_name (column_1 smallint, column_2 smallint)").

4> {ok, S} = epgsql:parse(C, "prepared_stmt_name", "insert into schema_name.table_name values ($1, $2)", [int4, int4]).

5> epgsql:squery(C, "execute prepared_stmt_name(1, 1)").
5> epgsql:squery(C, "select * from schema_name.table_name").
silathdiir

comment created time in 2 months

more