You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\set VERBOSITY verbose
set client_min_messages = warning;
drop view if exists v;
create or replace view v as select 17 as c1;
select * from v;
create or replace view v as select 42 as c1;
select * from v;
The first create or replace view silently succeeds. But the second one causes this error:
0A000: Alter table is not yet supported
However, the select that immediately follows this reports 42. This shows that the view definition is in fact replaced.
So the error message is entirely spurious.
The text was updated successfully, but these errors were encountered:
…ng a pre-exiting view
Summary:
[YSQL] Spurious "ERROR: 0A000: Alter table is not yet supported" from "create or replace view" #5071
```
create or replace view v as select 17 as c1;
select * from v;
```
```
create or replace view v as select 42 as c1;
select * from v;
```
The first create or replace view silently succeeds. But the second one causes this error:
```
0A000: Alter table is not yet supported
```
However, the select that immediately follows this reports 42. This shows that the view definition is in fact replaced.
**FIX **
The fix to this problem is to simply disable checking the IsYugabyteEnabled() function to throw out this error.
The function which gets called is AlterTableInternal. The series of operations that happen while calling this function is similar to AlterTable. The main thing that should be noted here is towards inspecting different code paths where this functions is called and providing relevant unit tests to check whether it functionally executes what the user expects. This functional testing is covered in the unit tests.
Test Plan:
**Unit Tests**
To run unit tests to verify this change, the following java test can be utilized.
```
$HOME/code/devtools/bin/ybd --java-test org.yb.pgsql.TestPgRegressFeature
```
One of the sql files that it triggers is //yb_feature_alter_table.sql// where the SQL command tests different places in the code where //AlterTableInternal// is called.
1. Any create or replace SQL command which modifies an existing view will call the //AlterTableInternal// function in line number 224 in //**view.c**//
2. When a create or replace view SQL modifies an existing view by adding additional columns to the view, //AlterTableInternal// in line number 192 at **//view.c//** is called in addition to the AlterTableInternal in line number 224 at **//view.c//**
The SQL tests as a part of this diff tests both functionality to check if they are working correctly.
Reviewers: alex, mihnea
Reviewed By: alex, mihnea
Subscribers: yql
Differential Revision: https://phabricator.dev.yugabyte.com/D9259
Using YB-2.1.8.2-b0. Testcase:
The first
create or replace view
silently succeeds. But the second one causes this error:However, the
select
that immediately follows this reports42
. This shows that the view definition is in fact replaced.So the error message is entirely spurious.
The text was updated successfully, but these errors were encountered: