Skip to content

Commit a989909

Browse files
authored
check for 'check_function_bodies' configuration parameter… (#2439)
* check for 'check_function_bodies' configuration parameter when creating functions * add test * [ga-bump-dep] Bump dependency in Doltgres by jennifersp * skip TIMETZ wire tests
1 parent 0873c7e commit a989909

File tree

12 files changed

+210
-107
lines changed

12 files changed

+210
-107
lines changed

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ 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.20260305221540-0e4e7d5f6c45
10-
github.com/dolthub/eventsapi_schema v0.0.0-20260205214132-a7a3c84c84a1
9+
github.com/dolthub/dolt/go v0.40.5-0.20260310215046-79aed2a71373
10+
github.com/dolthub/eventsapi_schema v0.0.0-20260310172945-37a9265ade69
1111
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
12-
github.com/dolthub/go-mysql-server v0.20.1-0.20260304235552-80791ce5e625
12+
github.com/dolthub/go-mysql-server v0.20.1-0.20260310164217-00c09a7c7cce
1313
github.com/dolthub/pg_query_go/v6 v6.0.0-20251215122834-fb20be4254d1
1414
github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216
15-
github.com/dolthub/vitess v0.0.0-20260304224106-95dd8eda10b0
15+
github.com/dolthub/vitess v0.0.0-20260309181228-a99af9c518ab
1616
github.com/fatih/color v1.13.0
1717
github.com/goccy/go-json v0.10.2
1818
github.com/gogo/protobuf v1.3.2

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,18 +245,18 @@ github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12 h1:I
245245
github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12/go.mod h1:rN7X8BHwkjPcfMQQ2QTAq/xM3leUSGLfb+1Js7Y6TVo=
246246
github.com/dolthub/dolt-mcp v0.3.4 h1:AyG5cw+fNWXDHXujtQnqUPZrpWtPg6FN6yYtjv1pP44=
247247
github.com/dolthub/dolt-mcp v0.3.4/go.mod h1:bCZ7KHvDYs+M0e+ySgmGiNvLhcwsN7bbf5YCyillLrk=
248-
github.com/dolthub/dolt/go v0.40.5-0.20260305221540-0e4e7d5f6c45 h1:KEmo4Az4bRzu1sVjOOEAmKBSHf+pAilTycL6qqNEFjA=
249-
github.com/dolthub/dolt/go v0.40.5-0.20260305221540-0e4e7d5f6c45/go.mod h1:Lg+RnHndwNibbP2Igbvqf4+PhVKS5y8E22H6ARIi7Dw=
250-
github.com/dolthub/eventsapi_schema v0.0.0-20260205214132-a7a3c84c84a1 h1:QePoMpa5qlquwUqRVyF9KAHsJAlYbE2+eZkMPAxeBXc=
251-
github.com/dolthub/eventsapi_schema v0.0.0-20260205214132-a7a3c84c84a1/go.mod h1:evuptFmr/0/j0X/g+3cveHEEOM5tqyRA15FNgirtOY0=
248+
github.com/dolthub/dolt/go v0.40.5-0.20260310215046-79aed2a71373 h1:xqnXV1ROlVFwqxlsQnIaFKW2dC71aqB76FbtSF8+Dcg=
249+
github.com/dolthub/dolt/go v0.40.5-0.20260310215046-79aed2a71373/go.mod h1:jBikfO1b23+pMqm6jd6P2EM2H6p64NAsUKCY4JXYI44=
250+
github.com/dolthub/eventsapi_schema v0.0.0-20260310172945-37a9265ade69 h1:JShhbqMw26nKx3pqqu/cFxOpzBkN+4elVhzuUfgDw2k=
251+
github.com/dolthub/eventsapi_schema v0.0.0-20260310172945-37a9265ade69/go.mod h1:SSLraQS/jGLYFgff3vuZ+JbVUct6vyEeMzjLBqWqoyM=
252252
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww=
253253
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2/go.mod h1:mIEZOHnFx4ZMQeawhw9rhsj+0zwQj7adVsnBX7t+eKY=
254254
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
255255
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
256256
github.com/dolthub/go-icu-regex v0.0.0-20250916051405-78a38d478790 h1:zxMsH7RLiG+dlZ/y0LgJHTV26XoiSJcuWq+em6t6VVc=
257257
github.com/dolthub/go-icu-regex v0.0.0-20250916051405-78a38d478790/go.mod h1:F3cnm+vMRK1HaU6+rNqQrOCyR03HHhR1GWG2gnPOqaE=
258-
github.com/dolthub/go-mysql-server v0.20.1-0.20260304235552-80791ce5e625 h1:pOKtS6gYJ5HiwdRb5KlRia0CRQjym6yyuvQE7auYOOw=
259-
github.com/dolthub/go-mysql-server v0.20.1-0.20260304235552-80791ce5e625/go.mod h1:8zqJ7NgJ7GEISN7VkYEmrrW3DodmHHMCEjIH72BkoEU=
258+
github.com/dolthub/go-mysql-server v0.20.1-0.20260310164217-00c09a7c7cce h1:GZoRSwYAgLucuxkbQzu5e7hd+LgnOl4J3N+ULYPHiEQ=
259+
github.com/dolthub/go-mysql-server v0.20.1-0.20260310164217-00c09a7c7cce/go.mod h1:ZPKRptEeXSk9Ytb9LhB+8tB4BkltxuNYiYDFvIqXD/4=
260260
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI=
261261
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q=
262262
github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE=
@@ -267,8 +267,8 @@ github.com/dolthub/pg_query_go/v6 v6.0.0-20251215122834-fb20be4254d1 h1:GY17cGA4
267267
github.com/dolthub/pg_query_go/v6 v6.0.0-20251215122834-fb20be4254d1/go.mod h1:qnrZP3/1slFl2Bq5yw38HLOsArZareGwdpEceriblLc=
268268
github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 h1:JWkKRE4EHUcEVQCMRBej8DYxjYjRz/9MdF/NNQh0o70=
269269
github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216/go.mod h1:e/FIZVvT2IR53HBCAo41NjqgtEnjMJGKca3Y/dAmZaA=
270-
github.com/dolthub/vitess v0.0.0-20260304224106-95dd8eda10b0 h1:zw8xnAPxlLoCGWiTbXVjPvLBBBX+b104WFCGJ0FEbSM=
271-
github.com/dolthub/vitess v0.0.0-20260304224106-95dd8eda10b0/go.mod h1:eLLslh1CSPMf89pPcaMG4yM72PQbTN9OUYJeAy0fAis=
270+
github.com/dolthub/vitess v0.0.0-20260309181228-a99af9c518ab h1:flxnJiyDc4fqOKnpzNCwo/muFLuzwhqPH0ou3j0VB8Q=
271+
github.com/dolthub/vitess v0.0.0-20260309181228-a99af9c518ab/go.mod h1:eLLslh1CSPMf89pPcaMG4yM72PQbTN9OUYJeAy0fAis=
272272
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
273273
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
274274
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=

server/analyzer/create_function.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,16 @@ func ValidateCreateFunction(ctx *sql.Context, a *analyzer.Analyzer, n sql.Node,
3636
return n, transform.SameTree, nil
3737
}
3838

39+
checkFunctionBodiesVar, err := ctx.GetSessionVariable(ctx, "check_function_bodies")
40+
if err != nil {
41+
return n, transform.SameTree, err
42+
}
43+
if checkFunctionBodiesVar.(int8) == 0 {
44+
return n, transform.SameTree, nil
45+
}
46+
3947
builder := planbuilder.New(ctx, a.Catalog, nil)
40-
_, _, err := builder.BindOnly(ct.SqlDefParsed, ct.SqlDef, nil)
48+
_, _, err = builder.BindOnly(ct.SqlDefParsed, ct.SqlDef, nil)
4149
if err != nil {
4250
return nil, transform.SameTree, err
4351
}

server/ast/alter_domain.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 ast
16+
17+
import (
18+
"github.com/dolthub/vitess/go/vt/sqlparser"
19+
20+
"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
21+
)
22+
23+
// nodeAlterDomain handles ALTER DOMAIN nodes.
24+
func nodeAlterDomain(ctx *Context, stmt *tree.AlterDomain) (sqlparser.Statement, error) {
25+
if stmt == nil {
26+
return nil, nil
27+
}
28+
29+
// We intentionally don't support OWNER TO since we don't support owning objects
30+
if _, ok := stmt.Cmd.(*tree.AlterDomainOwner); ok {
31+
return NewNoOp("OWNER TO is unsupported and ignored"), nil
32+
}
33+
34+
return NotYetSupportedError("ALTER DOMAIN is not yet supported")
35+
}

server/ast/convert.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func Convert(postgresStmt parser.Statement) (vitess.Statement, error) {
3333
return nodeAlterDatabase(ctx, stmt)
3434
case *tree.AlterDefaultPrivileges:
3535
return nodeAlterDefaultPrivileges(ctx, stmt)
36+
case *tree.AlterDomain:
37+
return nodeAlterDomain(ctx, stmt)
3638
case *tree.AlterFunction:
3739
return nodeAlterFunction(ctx, stmt)
3840
case *tree.AlterIndex:

testing/dumps/sql/Billoxinogen18_ar_backend.sql

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Downloaded from: https://github.com/Billoxinogen18/ar_backend/blob/6cfc633fc995510afa71f887a5c7d1fd6b568f61/neon_dump.sql
1+
-- Downloaded from: https://github.com/Billoxinogen18/ar_backend/blob/6cfc633fc995510afa71f887a5c7d1fd6b568f61/neon_dump.sql and updated ALTER TABLE AND DROP statements with IF EXISTS
22
--
33
-- PostgreSQL database dump
44
--
@@ -18,83 +18,83 @@ SET xmloption = content;
1818
SET client_min_messages = warning;
1919
SET row_security = off;
2020

21-
ALTER TABLE ONLY public.users DROP CONSTRAINT users_referrer_wallet_address_fkey;
22-
ALTER TABLE ONLY public.user_usdt_withdrawals DROP CONSTRAINT user_usdt_withdrawals_user_wallet_address_fkey;
23-
ALTER TABLE ONLY public.user_task_completions DROP CONSTRAINT user_task_completions_user_wallet_address_fkey;
24-
ALTER TABLE ONLY public.user_task_completions DROP CONSTRAINT user_task_completions_task_id_fkey;
25-
ALTER TABLE ONLY public.user_stakes DROP CONSTRAINT user_stakes_user_wallet_address_fkey;
26-
ALTER TABLE ONLY public.user_stakes DROP CONSTRAINT user_stakes_staking_plan_id_fkey;
27-
ALTER TABLE ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_stake_id_fkey;
28-
ALTER TABLE ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_referrer_wallet_address_fkey;
29-
ALTER TABLE ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_referred_wallet_address_fkey;
30-
ALTER TABLE ONLY public.coinflip_history DROP CONSTRAINT coinflip_history_user_wallet_address_fkey;
31-
DROP TRIGGER users_before_insert_set_referral_code ON public.users;
32-
DROP INDEX public.idx_users_referrer;
33-
DROP INDEX public.idx_users_referral_code;
34-
DROP INDEX public.idx_user_usdt_withdrawals_user;
35-
DROP INDEX public.idx_user_usdt_withdrawals_status;
36-
DROP INDEX public.idx_user_task_completions_user_task;
37-
DROP INDEX public.idx_user_task_completions_status;
38-
DROP INDEX public.idx_user_stakes_wallet_address;
39-
DROP INDEX public.idx_user_stakes_status;
40-
DROP INDEX public.idx_referral_rewards_status;
41-
DROP INDEX public.idx_referral_rewards_referrer;
42-
DROP INDEX public.idx_coinflip_history_user;
43-
DROP INDEX public.idx_announcements_active_pinned_published;
44-
DROP INDEX neon_auth.users_sync_deleted_at_idx;
45-
ALTER TABLE ONLY public.users DROP CONSTRAINT users_telegram_id_key;
46-
ALTER TABLE ONLY public.users DROP CONSTRAINT users_referral_code_key;
47-
ALTER TABLE ONLY public.users DROP CONSTRAINT users_pkey;
48-
ALTER TABLE ONLY public.user_usdt_withdrawals DROP CONSTRAINT user_usdt_withdrawals_pkey1;
49-
ALTER TABLE ONLY public.user_arix_withdrawals DROP CONSTRAINT user_usdt_withdrawals_pkey;
50-
ALTER TABLE ONLY public.user_usdt_withdrawals DROP CONSTRAINT user_usdt_withdrawals_onchain_tx_hash_key1;
51-
ALTER TABLE ONLY public.user_arix_withdrawals DROP CONSTRAINT user_usdt_withdrawals_onchain_tx_hash_key;
52-
ALTER TABLE ONLY public.user_task_completions DROP CONSTRAINT user_task_completions_pkey;
53-
ALTER TABLE ONLY public.user_stakes DROP CONSTRAINT user_stakes_pkey;
54-
ALTER TABLE ONLY public.user_stakes DROP CONSTRAINT user_stakes_onchain_unstake_tx_hash_key;
55-
ALTER TABLE ONLY public.user_stakes DROP CONSTRAINT user_stakes_onchain_stake_tx_hash_key;
56-
ALTER TABLE ONLY public.tasks DROP CONSTRAINT tasks_task_key_key;
57-
ALTER TABLE ONLY public.tasks DROP CONSTRAINT tasks_pkey;
58-
ALTER TABLE ONLY public.staking_plans DROP CONSTRAINT staking_plans_plan_key_key;
59-
ALTER TABLE ONLY public.staking_plans DROP CONSTRAINT staking_plans_pkey;
60-
ALTER TABLE ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_pkey;
61-
ALTER TABLE ONLY public.crash_rounds DROP CONSTRAINT crash_rounds_pkey;
62-
ALTER TABLE ONLY public.coinflip_history DROP CONSTRAINT coinflip_history_pkey;
63-
ALTER TABLE ONLY public.announcements DROP CONSTRAINT announcements_pkey;
64-
ALTER TABLE ONLY neon_auth.users_sync DROP CONSTRAINT users_sync_pkey;
65-
ALTER TABLE public.user_usdt_withdrawals ALTER COLUMN withdrawal_id DROP DEFAULT;
66-
ALTER TABLE public.user_task_completions ALTER COLUMN completion_id DROP DEFAULT;
67-
ALTER TABLE public.user_arix_withdrawals ALTER COLUMN withdrawal_id DROP DEFAULT;
68-
ALTER TABLE public.tasks ALTER COLUMN task_id DROP DEFAULT;
69-
ALTER TABLE public.staking_plans ALTER COLUMN plan_id DROP DEFAULT;
70-
ALTER TABLE public.referral_rewards ALTER COLUMN reward_id DROP DEFAULT;
71-
ALTER TABLE public.crash_rounds ALTER COLUMN id DROP DEFAULT;
72-
ALTER TABLE public.coinflip_history ALTER COLUMN game_id DROP DEFAULT;
73-
ALTER TABLE public.announcements ALTER COLUMN announcement_id DROP DEFAULT;
74-
DROP TABLE public.users;
75-
DROP SEQUENCE public.user_usdt_withdrawals_withdrawal_id_seq1;
76-
DROP SEQUENCE public.user_usdt_withdrawals_withdrawal_id_seq;
77-
DROP TABLE public.user_usdt_withdrawals;
78-
DROP SEQUENCE public.user_task_completions_completion_id_seq;
79-
DROP TABLE public.user_task_completions;
80-
DROP TABLE public.user_stakes;
81-
DROP TABLE public.user_arix_withdrawals;
82-
DROP SEQUENCE public.tasks_task_id_seq;
83-
DROP TABLE public.tasks;
84-
DROP SEQUENCE public.staking_plans_plan_id_seq;
85-
DROP TABLE public.staking_plans;
86-
DROP SEQUENCE public.referral_rewards_reward_id_seq;
87-
DROP TABLE public.referral_rewards;
88-
DROP SEQUENCE public.crash_rounds_id_seq;
89-
DROP TABLE public.crash_rounds;
90-
DROP SEQUENCE public.coinflip_history_game_id_seq;
91-
DROP TABLE public.coinflip_history;
92-
DROP SEQUENCE public.announcements_announcement_id_seq;
93-
DROP TABLE public.announcements;
94-
DROP TABLE neon_auth.users_sync;
95-
DROP FUNCTION public.set_referral_code();
96-
DROP FUNCTION public.generate_referral_code();
97-
DROP SCHEMA neon_auth;
21+
ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT users_referrer_wallet_address_fkey;
22+
ALTER TABLE IF EXISTS ONLY public.user_usdt_withdrawals DROP CONSTRAINT user_usdt_withdrawals_user_wallet_address_fkey;
23+
ALTER TABLE IF EXISTS ONLY public.user_task_completions DROP CONSTRAINT user_task_completions_user_wallet_address_fkey;
24+
ALTER TABLE IF EXISTS ONLY public.user_task_completions DROP CONSTRAINT user_task_completions_task_id_fkey;
25+
ALTER TABLE IF EXISTS ONLY public.user_stakes DROP CONSTRAINT user_stakes_user_wallet_address_fkey;
26+
ALTER TABLE IF EXISTS ONLY public.user_stakes DROP CONSTRAINT user_stakes_staking_plan_id_fkey;
27+
ALTER TABLE IF EXISTS ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_stake_id_fkey;
28+
ALTER TABLE IF EXISTS ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_referrer_wallet_address_fkey;
29+
ALTER TABLE IF EXISTS ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_referred_wallet_address_fkey;
30+
ALTER TABLE IF EXISTS ONLY public.coinflip_history DROP CONSTRAINT coinflip_history_user_wallet_address_fkey;
31+
DROP TRIGGER IF EXISTS users_before_insert_set_referral_code ON public.users;
32+
DROP INDEX IF EXISTS public.idx_users_referrer;
33+
DROP INDEX IF EXISTS public.idx_users_referral_code;
34+
DROP INDEX IF EXISTS public.idx_user_usdt_withdrawals_user;
35+
DROP INDEX IF EXISTS public.idx_user_usdt_withdrawals_status;
36+
DROP INDEX IF EXISTS public.idx_user_task_completions_user_task;
37+
DROP INDEX IF EXISTS public.idx_user_task_completions_status;
38+
DROP INDEX IF EXISTS public.idx_user_stakes_wallet_address;
39+
DROP INDEX IF EXISTS public.idx_user_stakes_status;
40+
DROP INDEX IF EXISTS public.idx_referral_rewards_status;
41+
DROP INDEX IF EXISTS public.idx_referral_rewards_referrer;
42+
DROP INDEX IF EXISTS public.idx_coinflip_history_user;
43+
DROP INDEX IF EXISTS public.idx_announcements_active_pinned_published;
44+
DROP INDEX IF EXISTS neon_auth.users_sync_deleted_at_idx;
45+
ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT users_telegram_id_key;
46+
ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT users_referral_code_key;
47+
ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT users_pkey;
48+
ALTER TABLE IF EXISTS ONLY public.user_usdt_withdrawals DROP CONSTRAINT user_usdt_withdrawals_pkey1;
49+
ALTER TABLE IF EXISTS ONLY public.user_arix_withdrawals DROP CONSTRAINT user_usdt_withdrawals_pkey;
50+
ALTER TABLE IF EXISTS ONLY public.user_usdt_withdrawals DROP CONSTRAINT user_usdt_withdrawals_onchain_tx_hash_key1;
51+
ALTER TABLE IF EXISTS ONLY public.user_arix_withdrawals DROP CONSTRAINT user_usdt_withdrawals_onchain_tx_hash_key;
52+
ALTER TABLE IF EXISTS ONLY public.user_task_completions DROP CONSTRAINT user_task_completions_pkey;
53+
ALTER TABLE IF EXISTS ONLY public.user_stakes DROP CONSTRAINT user_stakes_pkey;
54+
ALTER TABLE IF EXISTS ONLY public.user_stakes DROP CONSTRAINT user_stakes_onchain_unstake_tx_hash_key;
55+
ALTER TABLE IF EXISTS ONLY public.user_stakes DROP CONSTRAINT user_stakes_onchain_stake_tx_hash_key;
56+
ALTER TABLE IF EXISTS ONLY public.tasks DROP CONSTRAINT tasks_task_key_key;
57+
ALTER TABLE IF EXISTS ONLY public.tasks DROP CONSTRAINT tasks_pkey;
58+
ALTER TABLE IF EXISTS ONLY public.staking_plans DROP CONSTRAINT staking_plans_plan_key_key;
59+
ALTER TABLE IF EXISTS ONLY public.staking_plans DROP CONSTRAINT staking_plans_pkey;
60+
ALTER TABLE IF EXISTS ONLY public.referral_rewards DROP CONSTRAINT referral_rewards_pkey;
61+
ALTER TABLE IF EXISTS ONLY public.crash_rounds DROP CONSTRAINT crash_rounds_pkey;
62+
ALTER TABLE IF EXISTS ONLY public.coinflip_history DROP CONSTRAINT coinflip_history_pkey;
63+
ALTER TABLE IF EXISTS ONLY public.announcements DROP CONSTRAINT announcements_pkey;
64+
ALTER TABLE IF EXISTS ONLY neon_auth.users_sync DROP CONSTRAINT users_sync_pkey;
65+
ALTER TABLE IF EXISTS public.user_usdt_withdrawals ALTER COLUMN withdrawal_id DROP DEFAULT;
66+
ALTER TABLE IF EXISTS public.user_task_completions ALTER COLUMN completion_id DROP DEFAULT;
67+
ALTER TABLE IF EXISTS public.user_arix_withdrawals ALTER COLUMN withdrawal_id DROP DEFAULT;
68+
ALTER TABLE IF EXISTS public.tasks ALTER COLUMN task_id DROP DEFAULT;
69+
ALTER TABLE IF EXISTS public.staking_plans ALTER COLUMN plan_id DROP DEFAULT;
70+
ALTER TABLE IF EXISTS public.referral_rewards ALTER COLUMN reward_id DROP DEFAULT;
71+
ALTER TABLE IF EXISTS public.crash_rounds ALTER COLUMN id DROP DEFAULT;
72+
ALTER TABLE IF EXISTS public.coinflip_history ALTER COLUMN game_id DROP DEFAULT;
73+
ALTER TABLE IF EXISTS public.announcements ALTER COLUMN announcement_id DROP DEFAULT;
74+
DROP TABLE IF EXISTS public.users;
75+
DROP SEQUENCE IF EXISTS public.user_usdt_withdrawals_withdrawal_id_seq1;
76+
DROP SEQUENCE IF EXISTS public.user_usdt_withdrawals_withdrawal_id_seq;
77+
DROP TABLE IF EXISTS public.user_usdt_withdrawals;
78+
DROP SEQUENCE IF EXISTS public.user_task_completions_completion_id_seq;
79+
DROP TABLE IF EXISTS public.user_task_completions;
80+
DROP TABLE IF EXISTS public.user_stakes;
81+
DROP TABLE IF EXISTS public.user_arix_withdrawals;
82+
DROP SEQUENCE IF EXISTS public.tasks_task_id_seq;
83+
DROP TABLE IF EXISTS public.tasks;
84+
DROP SEQUENCE IF EXISTS public.staking_plans_plan_id_seq;
85+
DROP TABLE IF EXISTS public.staking_plans;
86+
DROP SEQUENCE IF EXISTS public.referral_rewards_reward_id_seq;
87+
DROP TABLE IF EXISTS public.referral_rewards;
88+
DROP SEQUENCE IF EXISTS public.crash_rounds_id_seq;
89+
DROP TABLE IF EXISTS public.crash_rounds;
90+
DROP SEQUENCE IF EXISTS public.coinflip_history_game_id_seq;
91+
DROP TABLE IF EXISTS public.coinflip_history;
92+
DROP SEQUENCE IF EXISTS public.announcements_announcement_id_seq;
93+
DROP TABLE IF EXISTS public.announcements;
94+
DROP TABLE IF EXISTS neon_auth.users_sync;
95+
DROP FUNCTION IF EXISTS public.set_referral_code();
96+
DROP FUNCTION IF EXISTS public.generate_referral_code();
97+
DROP SCHEMA IF EXISTS neon_auth;
9898
--
9999
-- Name: neon_auth; Type: SCHEMA; Schema: -; Owner: -
100100
--

testing/generation/command_docs/output/alter_domain_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ func TestAlterDomain(t *testing.T) {
3232
Parses("ALTER DOMAIN name DROP CONSTRAINT IF EXISTS constraint_name CASCADE"),
3333
Parses("ALTER DOMAIN name RENAME CONSTRAINT constraint_name TO new_constraint_name"),
3434
Parses("ALTER DOMAIN name VALIDATE CONSTRAINT constraint_name"),
35-
Parses("ALTER DOMAIN name OWNER TO new_owner"),
36-
Parses("ALTER DOMAIN name OWNER TO CURRENT_ROLE"),
37-
Parses("ALTER DOMAIN name OWNER TO CURRENT_USER"),
38-
Parses("ALTER DOMAIN name OWNER TO SESSION_USER"),
35+
Converts("ALTER DOMAIN name OWNER TO new_owner"),
36+
Converts("ALTER DOMAIN name OWNER TO CURRENT_ROLE"),
37+
Converts("ALTER DOMAIN name OWNER TO CURRENT_USER"),
38+
Converts("ALTER DOMAIN name OWNER TO SESSION_USER"),
3939
Parses("ALTER DOMAIN name RENAME TO new_name"),
4040
Parses("ALTER DOMAIN name SET SCHEMA new_schema"),
4141
}

testing/go/alter_table_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,5 +993,14 @@ func TestAlterTable(t *testing.T) {
993993
},
994994
},
995995
},
996+
{
997+
Name: "ALTER TABLE IF EXISTS",
998+
Assertions: []ScriptTestAssertion{
999+
{
1000+
Query: `ALTER TABLE IF EXISTS t1a ALTER COLUMN a SET NOT NULL;`,
1001+
Expected: []sql.Row{},
1002+
},
1003+
},
1004+
},
9961005
})
9971006
}

0 commit comments

Comments
 (0)