blob: 3ec5506702f73eff31f636c9a2c6d7609fd98363 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# The first three assignment expressions are coerced to match
# the corresponding column's type.
[default initial_logical_plan]
update test
set double_col=long_col+1, int_col=1.2, char_col='foo', vchar_col='foofoo'
where int_col+1>long_col
--
ERROR: The assigned value for the column int_col has the type Double, which cannot be safely coerced to the column's type Int NULL (2 : 28)
set double_col=long_col+1, int_col=1.2, char_col='foo', vcha...
^
==
update undefined_table
set int_col=1
--
ERROR: Unrecognized relation undefined_table (1 : 8)
update undefined_table
^
==
update test
set undefined_col=1
--
ERROR: Unrecognized attribute undefined_col (2 : 5)
set undefined_col=1
^
==
update test
set int_col=1, int_col=1
--
ERROR: Multiple assignments to the column int_col (2 : 16)
set int_col=1, int_col=1
^
==
update test
set float_col=int_col+1
--
ERROR: The assigned value for the column float_col has the type Float NULL, which cannot be safely coerced to the column's type Float (2 : 5)
set float_col=int_col+1
^
==
update test
set char_col=3
--
ERROR: The assigned value for the column char_col has the type Int, which cannot be safely coerced to the column's type Char(20) (2 : 5)
set char_col=3
^
==
# The assignment expression cannot have an aggregate function.
update test set int_col=count(*)+1
--
ERROR: Aggregate function not allowed in SET clause (1 : 25)
update test set int_col=count(*)+1
^
==
# The WHERE cannot have an aggregate function.
update test set int_col=1 where count(*)>1
--
ERROR: Aggregate function not allowed in WHERE clause (1 : 33)
update test set int_col=1 where count(*)>1
^