@@ -241,15 +241,24 @@ BoundStatement Relation::Bind(Binder &binder) {
241241}
242242
243243shared_ptr<Relation> Relation::InsertRel (const string &schema_name, const string &table_name) {
244- return make_shared_ptr<InsertRelation>(shared_from_this (), schema_name, table_name);
244+ return InsertRel (INVALID_CATALOG, schema_name, table_name);
245+ }
246+
247+ shared_ptr<Relation> Relation::InsertRel (const string &catalog_name, const string &schema_name,
248+ const string &table_name) {
249+ return make_shared_ptr<InsertRelation>(shared_from_this (), catalog_name, schema_name, table_name);
245250}
246251
247252void Relation::Insert (const string &table_name) {
248253 Insert (INVALID_SCHEMA, table_name);
249254}
250255
251256void Relation::Insert (const string &schema_name, const string &table_name) {
252- auto insert = InsertRel (schema_name, table_name);
257+ Insert (INVALID_CATALOG, schema_name, table_name);
258+ }
259+
260+ void Relation::Insert (const string &catalog_name, const string &schema_name, const string &table_name) {
261+ auto insert = InsertRel (catalog_name, schema_name, table_name);
253262 auto res = insert->Execute ();
254263 if (res->HasError ()) {
255264 const string prepended_message = " Failed to insert into table '" + table_name + " ': " ;
@@ -258,30 +267,37 @@ void Relation::Insert(const string &schema_name, const string &table_name) {
258267}
259268
260269void Relation::Insert (const vector<vector<Value>> &values) {
261- vector<string> column_names;
262- auto rel = make_shared_ptr<ValueRelation>(context->GetContext (), values, std::move (column_names), " values" );
263- rel->Insert (GetAlias ());
270+ throw InvalidInputException (" INSERT with values can only be used on base tables!" );
264271}
265272
266273void Relation::Insert (vector<vector<unique_ptr<ParsedExpression>>> &&expressions) {
267- vector<string> column_names;
268- auto rel = make_shared_ptr<ValueRelation>(context->GetContext (), std::move (expressions), std::move (column_names),
269- " values" );
270- rel->Insert (GetAlias ());
274+ (void )std::move (expressions);
275+ throw InvalidInputException (" INSERT with expressions can only be used on base tables!" );
271276}
272277
273278shared_ptr<Relation> Relation::CreateRel (const string &schema_name, const string &table_name, bool temporary,
274279 OnCreateConflict on_conflict) {
275- return make_shared_ptr<CreateTableRelation>(shared_from_this (), schema_name, table_name, temporary, on_conflict);
280+ return CreateRel (INVALID_CATALOG, schema_name, table_name, temporary, on_conflict);
281+ }
282+
283+ shared_ptr<Relation> Relation::CreateRel (const string &catalog_name, const string &schema_name,
284+ const string &table_name, bool temporary, OnCreateConflict on_conflict) {
285+ return make_shared_ptr<CreateTableRelation>(shared_from_this (), catalog_name, schema_name, table_name, temporary,
286+ on_conflict);
276287}
277288
278289void Relation::Create (const string &table_name, bool temporary, OnCreateConflict on_conflict) {
279- Create (INVALID_SCHEMA, table_name, temporary, on_conflict);
290+ Create (INVALID_CATALOG, INVALID_SCHEMA, table_name, temporary, on_conflict);
280291}
281292
282293void Relation::Create (const string &schema_name, const string &table_name, bool temporary,
283294 OnCreateConflict on_conflict) {
284- auto create = CreateRel (schema_name, table_name, temporary, on_conflict);
295+ Create (INVALID_CATALOG, schema_name, table_name, temporary, on_conflict);
296+ }
297+
298+ void Relation::Create (const string &catalog_name, const string &schema_name, const string &table_name, bool temporary,
299+ OnCreateConflict on_conflict) {
300+ auto create = CreateRel (catalog_name, schema_name, table_name, temporary, on_conflict);
285301 auto res = create->Execute ();
286302 if (res->HasError ()) {
287303 const string prepended_message = " Failed to create table '" + table_name + " ': " ;
0 commit comments