Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: support placeholders in logictest #3854

Closed
mberhault opened this issue Jan 14, 2016 · 10 comments
Closed

sql: support placeholders in logictest #3854

mberhault opened this issue Jan 14, 2016 · 10 comments
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Milestone

Comments

@mberhault
Copy link
Contributor

We really don't test placeholders very much, and I'm running into a lot of issues with them when changing out sql shell to the postgres driver.

We should probably add support for those in the logic tests.
The tedious part is handling all types. We could do something similar to the query <col types> statement.

@mberhault mberhault added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) SQL labels Jan 14, 2016
@petermattis
Copy link
Collaborator

I think sql/pgwire_test.go is a more appropriate place to test our placeholder support.

@tamird
Copy link
Contributor

tamird commented Jan 14, 2016

Agreed.

On Thu, Jan 14, 2016 at 2:01 PM, Peter Mattis notifications@github.com
wrote:

I think sql/pgwire_test.go is a more appropriate place to test our
placeholder support.


Reply to this email directly or view it on GitHub
#3854 (comment)
.

@mberhault
Copy link
Contributor Author

wouldn't the testdata format be much simpler to do vast coverage of things? it shouldn't be too complicated to make the logictest handle these.

@bdarnell
Copy link
Contributor

In #3819, we've discovered that some commands can fail when the extended query protocol is used, but fail with the simple query protocol used in the logic tests. To make sure we've fixed all of these we need to make sure that all statement types are covered by tests that use placeholders. We'd be more likely to have comprehensive test coverage of placeholder usage if they could be written in the more familiar logic test format, although I'm not sure if that justifies the complexity of all the parsing and reflection that would be required.

@maddyblue
Copy link
Contributor

As of #4037, there are many tests in pgwire_test.go to test placeholders. Are these suffient?

@petermattis
Copy link
Collaborator

I'm not convinced about adding something logic-test specific to support placeholders, but adding support for PREPARE and EXECUTE statements would allow us to test placeholders from the logic test framework and elsewhere. The downside of PREPARE and EXECUTE is that they would not be the same code path as pgwire prepare/execute.

@RaduBerinde
Copy link
Member

I'll add my 2 cents - AFAICT pgwire_test has some limitations which makes a lot of things hard to test:

  • statements can't be executed in a certain order (they're in a map), so you can't do even simple things like insert then select
  • queries can only return exactly one row (technically they have to return at least one row and we only verify the first one)
  • tests are broken up into Exec and Queries; the infrastructure should allow both kinds in a single test, and tests should be split up according to what area they test (similar to how logic tests are split up)

If we do not go the logic test route and pgwire_test has to suffice, then we should fix these limitations.

@maddyblue
Copy link
Contributor

I'm in favor of fixing all of the limitations listed by Radu in pgwire_test and leaving the logic tests alone.

@tamird
Copy link
Contributor

tamird commented Mar 2, 2016

+1 to fixing limitations in pgwire_test and leaving logic tests alone. trying to do the correct thing with respect to types in logic tests won't be possible without heavyweight additions to the syntax to support type annotations.

@tamird
Copy link
Contributor

tamird commented Jun 30, 2016

Doesn't sound like anyone's rushing to do this, and the PREPARE/EXECUTE/RELEASE work is tracked in #7123.

@tamird tamird closed this as completed Jun 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

No branches or pull requests

6 participants