File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Copyright 2026 Dolthub, Inc.
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ package core
16+
17+ // IsValidPostgresIdentifier returns true according to Postgres quoted identifier rules.
18+ // Quoted identifiers can contain any character except the null character (code zero),
19+ // including supplementary Unicode (emoji, code points above U+FFFF) unlike MySQL.
20+ // https://www.postgresql.org/docs/current/sql-syntax-lexical.html
21+ func IsValidPostgresIdentifier (name string ) bool {
22+ if len (name ) == 0 {
23+ return false
24+ }
25+ for _ , c := range name {
26+ if c == 0x0000 {
27+ return false
28+ }
29+ }
30+ return true
31+ }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ require (
66 github.com/PuerkitoBio/goquery v1.8.1
77 github.com/cockroachdb/apd/v2 v2.0.3-0.20200518165714-d020e156310a
88 github.com/cockroachdb/errors v1.7.5
9- github.com/dolthub/dolt/go v0.40.5-0.20260414181222-29a5ed0fef4f
9+ github.com/dolthub/dolt/go v0.40.5-0.20260414231020-4781ced3f3b8
1010 github.com/dolthub/eventsapi_schema v0.0.0-20260310172945-37a9265ade69
1111 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
1212 github.com/dolthub/go-mysql-server v0.20.1-0.20260412215059-d7fc9477f4b7
Original file line number Diff line number Diff line change @@ -245,8 +245,8 @@ github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12 h1:I
245245github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12 /go.mod h1:rN7X8BHwkjPcfMQQ2QTAq/xM3leUSGLfb+1Js7Y6TVo =
246246github.com/dolthub/dolt-mcp v0.3.4 h1:AyG5cw+fNWXDHXujtQnqUPZrpWtPg6FN6yYtjv1pP44 =
247247github.com/dolthub/dolt-mcp v0.3.4 /go.mod h1:bCZ7KHvDYs+M0e+ySgmGiNvLhcwsN7bbf5YCyillLrk =
248- github.com/dolthub/dolt/go v0.40.5-0.20260414181222-29a5ed0fef4f h1:j/hURnYQxMIypeNFBp5SCXMl9B9j6BdEaE2gMFnvVZA =
249- github.com/dolthub/dolt/go v0.40.5-0.20260414181222-29a5ed0fef4f /go.mod h1:herP1qJMjcHmk0i4211oIP8WEfKWIk9aXEYJ9/ha59M =
248+ github.com/dolthub/dolt/go v0.40.5-0.20260414231020-4781ced3f3b8 h1:rsJXcFV3eYnUV2yeS9g6ZMvL4d+EnSaaPRb0SyaEX1M =
249+ github.com/dolthub/dolt/go v0.40.5-0.20260414231020-4781ced3f3b8 /go.mod h1:herP1qJMjcHmk0i4211oIP8WEfKWIk9aXEYJ9/ha59M =
250250github.com/dolthub/eventsapi_schema v0.0.0-20260310172945-37a9265ade69 h1:JShhbqMw26nKx3pqqu/cFxOpzBkN+4elVhzuUfgDw2k =
251251github.com/dolthub/eventsapi_schema v0.0.0-20260310172945-37a9265ade69 /go.mod h1:SSLraQS/jGLYFgff3vuZ+JbVUct6vyEeMzjLBqWqoyM =
252252github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww =
Original file line number Diff line number Diff line change 1515package tables
1616
1717import (
18+ "github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
1819 "github.com/dolthub/dolt/go/libraries/doltcore/sqle"
1920 "github.com/dolthub/go-mysql-server/sql"
21+
22+ "github.com/dolthub/doltgresql/core"
2023)
2124
2225// Init handles initialization of all Postgres-specific and Doltgres-specific tables.
@@ -27,4 +30,5 @@ func Init() {
2730 }
2831 return db , nil
2932 }
33+ doltdb .IsValidIdentifier = core .IsValidPostgresIdentifier
3034}
Original file line number Diff line number Diff line change @@ -23,6 +23,28 @@ import (
2323
2424func TestCreateTable (t * testing.T ) {
2525 RunScripts (t , []ScriptTest {
26+ {
27+ // https://github.com/dolthub/doltgresql/issues/2580
28+ Name : "create table with UTF8 identifiers" ,
29+ Assertions : []ScriptTestAssertion {
30+ {
31+ Query : `CREATE TABLE foo😏(data🍆 TEXT);` ,
32+ Expected : []sql.Row {},
33+ },
34+ {
35+ Query : `CREATE INDEX idx🍤 ON foo😏(data🍆);` ,
36+ Expected : []sql.Row {},
37+ },
38+ {
39+ Query : `Insert into foo😏 (data🍆) VALUES ('foo');` ,
40+ Expected : []sql.Row {},
41+ },
42+ {
43+ Query : `SELECT data🍆 FROM foo😏;` ,
44+ Expected : []sql.Row {{"foo" }},
45+ },
46+ },
47+ },
2648 {
2749 Name : "create table with primary key" ,
2850 Assertions : []ScriptTestAssertion {
You can’t perform that action at this time.
0 commit comments