[tarantool-patches] Re: [PATCH v1 1/1] sql: rework "no such object" and "object exists" errors

Konstantin Osipov kostja at tarantool.org
Fri Feb 15 15:50:07 MSK 2019


* n.pettik <korablev at tarantool.org> [19/02/15 15:46]:
> > +	/*148 */_(ER_NO_SUCH_INDEX_NAME,	"No index '%s' is defined in space '%s'") \
> 
> I’d better say ’No index with name …’.
> But it is to be discussed.

It's a copycat of the INDEX_ID message.

> > +	/*153 */_(ER_NO_SUCH_FIELD_NAME,	"Field '%s' doesn't exist") \
> 
> Mb it is better to split this error into two:
> “Space %s doesn’t feature field with name %s” and
> “Unresolved column name %s”
> 
> Again, I’m neither SQL expert nor technical writer, so it is not up to me.

In a separate patch.

> > /**
> > + * Increment error counter if error suppression isn't set.
> > + *
> > + * @param parse_context Current parsing context.
> > + */
> > +void
> > +sql_parser_error(struct Parse *parse_context);
> 
> I suggest to incapsulate call of diag set inside this
> function. To achieve this, lets make function take
> variadic params. It would allow us to reduce size
> of refactored code, at least.

Nikita, I agree in general but given this entire function is
temporary, I think it's good enough.

> > }
> > 
> > +void
> > +sql_parser_error(struct Parse *parse_context)
> > +{
> > +	if (parse_context->db->suppressErr)
> > +		return;
> 
> As Konstantin pointed out, seems like we don’t need
> taking into consideration suppressErr here.
> 
> > +	parse_context->nErr++;
> > +	parse_context->rc = SQL_TARANTOOL_ERROR;
> > +}
> > +
> > +
> 
> Extra blank line.

Good point, I agree!

> > --
> > box.sql.execute("CREATE TABLE w2 (s1 INT PRIMARY KEY, CHECK ((SELECT COUNT(*) FROM w2) = 0));")
> > ---
> > -- error: 'Failed to create space ''W2'': SQL error: no such table: W2'
> > +- error: 'Failed to create space ''W2'': Space ''W2'' does not exist’
> 
> Hm, IMHO looks a bit misleading.
> Could we improve error reporting in this case?
> It would be nice to see smth like “name cannot be resolved” or
> “Misuse of space forward declaration”.

In a separate patch, please.
> 

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list