The exception unrecognized_entity_exception used to have two fields:
* entity - the name that wasn't recognized
* relation_str - part of the WHERE clause that contained this entity
In 4e0a089f3e the places that throw
this exception were modified, the thrower started passing unrecognized
column name to both fields - entity and relation_str. It was easier to
do things this way, accessing the whole WHERE clause can be problematic.
The problem is that this caused error messages to get weird, e.g:
"Undefined name x in where clause ('x')".
x is not the WHERE clause, it's the unrecognized name.
Let's remove the `relation_str` field as it isn't used anymore,
it only causes confusion. After this change the message would be:
"Unrecognized name x"
Which makes much more sense.
Refs #10632
Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
Closes #13944
40 lines
828 B
C++
40 lines
828 B
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*
|
|
* Modified by ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "exceptions.hh"
|
|
#include <seastar/core/shared_ptr.hh>
|
|
#include "cql3/column_identifier.hh"
|
|
|
|
namespace exceptions {
|
|
|
|
/**
|
|
* Exception thrown when an entity is not recognized.
|
|
*/
|
|
class unrecognized_entity_exception : public invalid_request_exception {
|
|
public:
|
|
/**
|
|
* The unrecognized entity.
|
|
*/
|
|
cql3::column_identifier entity;
|
|
|
|
/**
|
|
* Creates a new <code>UnrecognizedEntityException</code>.
|
|
* @param entity the unrecognized entity
|
|
*/
|
|
unrecognized_entity_exception(cql3::column_identifier entity)
|
|
: invalid_request_exception(format("Unrecognized name {}", entity))
|
|
, entity(std::move(entity))
|
|
{ }
|
|
};
|
|
|
|
}
|