Skip to content

expressions: operator supports []byte type#39

Merged
siddontang merged 1 commit intomasterfrom
siddontang/op-expr-with-bytes
Sep 7, 2015
Merged

expressions: operator supports []byte type#39
siddontang merged 1 commit intomasterfrom
siddontang/op-expr-with-bytes

Conversation

@siddontang
Copy link
Member

Support expression like:

select 1 + cast("123" as binary);

@ngaut
Copy link
Member

ngaut commented Sep 7, 2015

LGTM

1 similar comment
@qiuyesuifeng
Copy link
Member

LGTM

siddontang added a commit that referenced this pull request Sep 7, 2015
expressions: operator supports []byte type
@siddontang siddontang merged commit b8dae9a into master Sep 7, 2015
@siddontang siddontang deleted the siddontang/op-expr-with-bytes branch September 7, 2015 09:32
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
okJiang pushed a commit to okJiang/tidb that referenced this pull request Oct 19, 2021
* support statement-size

* support statement-size

* add unit test

Co-authored-by: 3pointer <luancheng@pingcap.com>
rleungx pushed a commit to rleungx/tidb that referenced this pull request Feb 26, 2024
* init

* audit: init first version of audit log

* audit: support log global rotate

* audit: update log keys

* audit: more common notify implement

* audit: add record id

* audit: rename some names

* audit: default use normal log path

* audit: add server ip info

* audit: do some refine

* audit: Add some log keys

* audit: update some item format

* audit: add stmt demo

* audit: support redact

* audit: fix bug

* audit: update filter

* audit: update filter

* audit: check user

* audit: update

* update

* audit: update

* audit: fix bug

* aduit: update

* audit: update

* update

* update

* audit: add filter unit test

* fmt

* Add tests for `tidb_audit_enabled` and `tidb_audit_log`

* Add tests for `tidb_audit_log_max_size` and `tidb_audit_log_max_lifetime`

* Add tests for `tidb_audit_log_reserved_*`

* TODO: TestAuditLogRedact

* Fininsh `TestAuditLogRedact`

* Update (pingcap#1)

* fix typo (pingcap#2)

* Add `TRANSACTION`

* rename sysvar

* audit_log_create_filter, audit_log_remove_filter

* finish function call and table test

* test privilege

* finish test for sysvar

* TODO: TestConnectionEvenClass

* update

* audit: fix lint for audit log (pingcap#1)

* audit: fix UT failure caused by the change of redact log (pingcap#3)

* audit: use `t.TempDir()` to make test stable (pingcap#4)

* audit: fix test failed for 7.1

* Add `OWNERS` file (pingcap#35)

Co-authored-by: Chao Wang <cclcwangchao@hotmail.com>

* audit: fix panic when logging sometime (pingcap#26) (pingcap#31)

* test: fix unstable test TestAuditLogReservedDays (pingcap#8)

* Format sysvar_test.go

* audit: use `StatementContext` to generate redacted SQL (pingcap#9)

* audit: fix panic when logging sometime (pingcap#26)

* update

* add owner

* Update OWNERS

---------

Co-authored-by: CbcWestwolf <1004626265@qq.com>
Co-authored-by: wuhuizuo <wuhuizuo@126.com>

* audit: fix panic sometimes when `create user` without password (pingcap#37) (pingcap#39)

* This is an automated cherry-pick of pingcap#37

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* fix conflict

---------

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Co-authored-by: 王超 <cclcwangchao@hotmail.com>

* extension/audit: introduce serverless audit log

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* update bazel config

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* support enable audit log when activate

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* add gwconnid to audit log

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* comment unstable test

* update bazel

* add log about activate request

* diff audit log enabled

* audit: fix memory leak for executeSQL (pingcap#44) (pingcap#45)

* This is an automated cherry-pick of pingcap#44

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* Update util.go

---------

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Co-authored-by: 王超 <cclcwangchao@hotmail.com>

* Update extension/serverless/OWNERS

---------

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>
Co-authored-by: Chao Wang <cclcwangchao@hotmail.com>
Co-authored-by: cbcwestwolf <1004626265@qq.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Co-authored-by: wuhuizuo <wuhuizuo@126.com>
Co-authored-by: zzm <zhouzemin@pingcap.com>
Co-authored-by: Yuqing Bai <baiyuq@gmail.com>
guoshouyan pushed a commit to guoshouyan/tidb that referenced this pull request Mar 5, 2024
… (pingcap#39)

close pingcap#50359

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 9, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 9, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 9, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 9, 2024
wuhuizuo added a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
wuhuizuo added a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
crazycs520 pushed a commit to crazycs520/tidb that referenced this pull request Jun 4, 2025
…cap#39)

<!--

Thank you for contributing to TiDB!

PR Title Format:
1. pkg [, pkg2, pkg3]: what's changed
2. *: what's changed

-->

### What problem does this PR solve?
<!--

Please create an issue first to describe the problem.

There MUST be one line starting with "Issue Number:  " and
linking the relevant issues via the "close" or "ref".

For more info, check https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/contribute-code.html#referring-to-an-issue.

-->

行为参考:https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/SYS_CONTEXT.html
1. CURRENT_SCHEMA
未选择 Schema:

```
mysql> SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') as CURRENT_SCHEMA FROM dual;
+----------------+
| CURRENT_SCHEMA |
+----------------+
|                |
+----------------+
1 row in set (0.00 sec)
```

选择 test schema:

```
mysql> use test
Database changed
mysql> SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') as CURRENT_SCHEMA FROM dual;
+----------------+
| CURRENT_SCHEMA |
+----------------+
| test           |
+----------------+
1 row in set (0.00 sec)
```

1. CURRENT_USER

```
mysql> SELECT SYS_CONTEXT('USERENV', 'CURRENT_USER') as `CURRENT_USER` FROM dual;
+--------------+
| CURRENT_USER |
+--------------+
| root         |
+--------------+
1 row in set (0.00 sec)

mysql> SELECT SYS_CONTEXT('USERENV', 'CURRENT_USER') as CURRENT_USERID FROM dual;
+----------------+
| CURRENT_USERID |
+----------------+
| root           |
+----------------+
1 row in set (0.00 sec)
```

1. SESSIONID

```
mysql> SELECT SYS_CONTEXT('USERENV', 'SESSIONID') as session_id FROM dual;
+------------+
| session_id |
+------------+
| 2097156    |
+------------+
1 row in set (0.00 sec)
```

1. 指定长度参数截断结果

```
mysql> SELECT SYS_CONTEXT('USERENV', 'CURRENT_USER', 3) as CURRENT_USERID FROM dual;
+----------------+
| CURRENT_USERID |
+----------------+
| roo            |
+----------------+
1 row in set (0.00 sec)

```

1. 各种错误

```
# 指定的参数不存在
mysql> SELECT SYS_CONTEXT('USERENV', 'NE') as CURRENT_USERID FROM dual;
ERROR 1105 (HY000): invalid USERENV parameter

# 指定的命名空间不存在
mysql> SELECT SYS_CONTEXT('NE', 'NE') as session_id FROM dual;
ERROR 1105 (HY000): invalid namespace

# 参数数量传少或传多
mysql> SELECT SYS_CONTEXT('NE') as session_id FROM dual;
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'sys_context'

mysql> SELECT SYS_CONTEXT('NE', 'NE', 4, 4) as session_id FROM dual;
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'sys_context'
```

### What changed and how does it work?

### Check List

Tests <!-- At least one of them must be included. -->

- [ ] Unit test
- [ ] Integration test
- [x] Manual test (add detailed scripts or steps below)
- [ ] No need to test
  > - [ ] I checked and no code files have been changed.
  > <!-- Or your custom  "No need to test" reasons -->

Side effects

- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Breaking backward compatibility

Documentation

- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [ ] Contains experimental features
- [ ] Changes MySQL compatibility

### Release note

<!-- compatibility change, improvement, bugfix, and new feature need a release note -->

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

```release-note
None
```

Reviewed-on: https://git.pingcap.net/pingkai/tidb/pulls/39
Reviewed-by: crazycs520 <chenshuang@pingcap.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants