Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: "n.pettik" <korablev@tarantool.org>
Cc: tarantool-patches@freelists.org, Imeev Mergen <imeevma@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: rework "no such object" and "object exists" errors
Date: Fri, 15 Feb 2019 15:50:07 +0300	[thread overview]
Message-ID: <20190215125007.GB14894@chai> (raw)
In-Reply-To: <168FF7F0-A4AA-42DD-AF9A-FA95098ADBBA@tarantool.org>

* n.pettik <korablev@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

  reply	other threads:[~2019-02-15 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 10:06 [tarantool-patches] " imeevma
2019-02-15 12:44 ` [tarantool-patches] " n.pettik
2019-02-15 12:50   ` Konstantin Osipov [this message]
2019-02-15 13:12     ` n.pettik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190215125007.GB14894@chai \
    --to=kostja@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: rework "no such object" and "object exists" errors' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox