Skip to content

Commit 44d2550

Browse files
committed
Add english version of document
1 parent 806917a commit 44d2550

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

EN/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*** xref:master/6.3.2.adoc[OUT Parameter]
2626
*** xref:master/6.3.4.adoc[%Type & %Rowtype]
2727
*** xref:master/6.3.5.adoc[NLS Parameters]
28+
*** xref:master/6.3.6.adoc[Case Conversion]
2829
** xref:master/6.4.adoc[GB18030 Character Set]
2930
* List of Oracle compatible features
3031
** xref:master/7.1.adoc[1、Ivorysql frame design]
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
:sectnums:
2+
:sectnumlevels: 5
3+
4+
:imagesdir: ./_images
5+
6+
= Quoted Identifier Case Conversion
7+
8+
== Purpose
9+
10+
To meet Oracle's quoted identifier case compatibility requirements, IvorySQL has designed three case conversion modes for quoted identifiers.
11+
12+
== Implementation Details
13+
14+
If the parameter `-C` is appended during database initialization, with values of `normal/interchange/lowercase`, the `Intidb.c->main()` function in the code will process this parameter and set the global variable `caseswitchmode` according to the parameter value. Then the `initdb` command will start a `postgres` process in `-boot` mode to set up the `template1` template database, while passing the parameter `-C ivorysql.identifier_case_switch=caseswitchmode` to the new process.
15+
16+
This newly started backend process will write the `identifier_case_switch` information to the `pg_control` file through the following code:
17+
18+
```
19+
BootstrapModeMain() -> BootStrapXLOG();
20+
/* save database compatible level value */
21+
ControlFile->dbmode = bootstrap_database_mode;
22+
ControlFile->casemode = identifier_case_switch;
23+
24+
/* some additional ControlFile fields are set in WriteControlFile() */
25+
WriteControlFile();
26+
```
27+
28+
When a user starts the database using the `pg_ctl` command, the `postmaster` process will read the contents of the `pg_control` file. The code call path is:
29+
30+
```
31+
PostmasterMain()-->SetCaseGucOption()-->GetCaseSwitchModeFromControl()
32+
```
33+
34+
After reading the parameter value, the `SetConfigOption()` function is called to assign the value.
35+
36+
When each new backend process starts, since it is forked from the `postmaster` process, it automatically has the same `ivorysql.identifier_case_switch` parameter value. First, it processes the `startup` packet, and if it contains `database` or `user` parameters, the parameter values are processed accordingly based on `identifier_case_switch`.
37+
38+
The source code is:
39+
40+
```
41+
BackendMain()->BackendInitialize()-->ProcessStartupPacket()
42+
```
43+
44+
Additionally, when processing user SQL statements, if they contain identifiers, the same processing is performed. The code is distributed in:
45+
SplitIdentifierString(), quoteOneName() and SplitGUCList() functions.
46+
47+
48+

0 commit comments

Comments
 (0)