Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

sql: quantize as aliases. #225

Merged
merged 3 commits into from
Feb 22, 2017
Merged

sql: quantize as aliases. #225

merged 3 commits into from
Feb 22, 2017

Conversation

clutchski
Copy link

@clutchski clutchski commented Feb 6, 2017

some of them can be unbounded and don't materially change the contents
of the query. here's the direct case:

SELECT pg_try_advisory_lock ( ? ) AS tabcdef1235

this could also be quantized to SELECT pg_try_advisory_lock ( ? ) but i din't do that.

some of them can be unbounded and don't materially change the contents
of the query. here's the direct case:

    SELECT pg_try_advisory_lock ( ? ) AS tabcdef1235
@@ -25,28 +24,16 @@ type QuantizeFunction func(model.Span) model.Span
func Quantize(span model.Span) model.Span {
switch span.Type {
case sqlType:
fallthrough
return QuantizeSQL(span)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit is better than implicit

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@clutchski clutchski requested a review from palazzem February 6, 2017 22:04
Copy link

@palazzem palazzem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go!

@@ -25,28 +24,16 @@ type QuantizeFunction func(model.Span) model.Span
func Quantize(span model.Span) model.Span {
switch span.Type {
case sqlType:
fallthrough
return QuantizeSQL(span)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

quantizer/sql.go Outdated
@@ -51,6 +51,8 @@ func (f *ReplaceFilter) Filter(token, lastToken int, buffer []byte) (int, []byte
return Filtered, []byte("?")
case Limit:
return token, buffer
case As:
return token, []byte("?")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy that is quite easy to extend quantizer rules

@@ -244,6 +244,10 @@ func TestSQLQuantizer(t *testing.T) {
"SELECT * FROM public.table ( array [ ROW ( array [ 'magic', 'foo',",
"SELECT * FROM public.table ( array [ ROW ( array [ ?",
},
{
"SELECT pg_try_advisory_lock (123) AS t46eef3f025cc27feb31ca5a2d668a09a",
"SELECT pg_try_advisory_lock ( ? ) AS ?",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I think it's ok, we may want (as you've already suggested) to drop all tables/store procedures aliasing. We may keep track of this change for the future.

@LotharSee
Copy link

@palazzem we talked about completely dropping all the AS ?, would it be hard to adapt this PR to make it work?

@LeoCavaille LeoCavaille modified the milestone: 5.12 Feb 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants