pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
garbage data back
9+ messages / 3 participants
[nested] [flat]

* garbage data back
@ 2023-03-06 20:17  Brad White <b55white@gmail.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Brad White @ 2023-03-06 20:17 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

I was doing a SELECT * FROM view WHERE field LIKE pattern
and getting garbage data back.

Turns out it is filtering on a different field.

As you can see here, when attempting to filter on the FileKey, it is
actually filtering on the Order Item ID field.

select "FileKey", "OrderItemID" from "vw_rptInvc_Permits"
where "FileKey" LIKE '%1317'

[image: image.png]
I'm stumped. Any guesses?

Attachments:

image.png (image/png, 6.7K) download view image
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: garbage data back
@ 2023-03-06 20:23  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Brad White <b55white@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Adrian Klaver @ 2023-03-06 20:23 UTC (permalink / raw)
  To: Brad White <b55white@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 3/6/23 12:17, Brad White wrote:
> I was doing a SELECT * FROM view WHERE field LIKE pattern
> and getting garbage data back.
> 
> Turns out it is filtering on a different field.
> 
> As you can see here, when attempting to filter on the FileKey, it is 
> actually filtering on the Order Item ID field.
> 
> select "FileKey", "OrderItemID" from "vw_rptInvc_Permits"
> where "FileKey" LIKE '%1317'
> 
> image.png
> I'm stumped. Any guesses?


What is the view definition?

Is there a table named vw_rptInvc_Permits?

-- 
Adrian Klaver
adrian.klaver@aklaver.com






^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: garbage data back
@ 2023-03-06 20:29  David G. Johnston <david.g.johnston@gmail.com>
  parent: Brad White <b55white@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: David G. Johnston @ 2023-03-06 20:29 UTC (permalink / raw)
  To: Brad White <b55white@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Mon, Mar 6, 2023 at 1:18 PM Brad White <b55white@gmail.com> wrote:

>
> As you can see here, when attempting to filter on the FileKey, it is
> actually filtering on the Order Item ID field.
>
> select "FileKey", "OrderItemID" from "vw_rptInvc_Permits"
> where "FileKey" LIKE '%1317'
>
> I'm stumped. Any guesses?
>

Agreed, what you've shown doesn't make sense.

Try:
EXPLAIN ANALYZE
REINDEX (on any underlying table indexes)

Show the version you are running.

David J.

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Fwd: garbage data back
@ 2023-03-06 20:48  Brad White <b55white@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Brad White @ 2023-03-06 20:48 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

LOL

Joke's on me.

Here's the relevant part of the view

SELECT ...
    "Order Items"."ID" AS "OrderItemID",
    ...
    (("Orders"."ID" || '-'::text) || "Order Items"."ID") AS "FileKey"

Wait, then why are the Item IDs different?

Here are the results again, with the FileKey field expanded a bit.
[image: image.png]

On Mon, Mar 6, 2023 at 2:23 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 3/6/23 12:17, Brad White wrote:
> > I was doing a SELECT * FROM view WHERE field LIKE pattern
> > and getting garbage data back.
> >
> > Turns out it is filtering on a different field.
> >
> > As you can see here, when attempting to filter on the FileKey, it is
> > actually filtering on the Order Item ID field.
> >
> > select "FileKey", "OrderItemID" from "vw_rptInvc_Permits"
> > where "FileKey" LIKE '%1317'
> >
> > image.png
> > I'm stumped. Any guesses?
>
>
> What is the view definition?
>
> Is there a table named vw_rptInvc_Permits?
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>

Attachments:

image.png (image/png, 7.3K) download view image
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: garbage data back
@ 2023-03-06 20:54  David G. Johnston <david.g.johnston@gmail.com>
  parent: Brad White <b55white@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: David G. Johnston @ 2023-03-06 20:54 UTC (permalink / raw)
  To: Brad White <b55white@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Mon, Mar 6, 2023 at 1:48 PM Brad White <b55white@gmail.com> wrote:

> LOL
>
> Joke's on me.
>
> Here's the relevant part of the view
>
> SELECT ...
>     "Order Items"."ID" AS "OrderItemID",
>     ...
>     (("Orders"."ID" || '-'::text) || "Order Items"."ID") AS "FileKey"
>
> Wait, then why are the Item IDs different?
>
> Here are the results again, with the FileKey field expanded a bit.
> [image: image.png]
>

I don't understand what you are questioning...FileKey is a hyphenated
concatenation of the ORDER Id and the ORDER ITEM Id, while OrderItemID is
just the later - and the suffix of the former matches the later.

David J.

Attachments:

image.png (image/png, 7.3K) download view image
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: Fwd: garbage data back
@ 2023-03-06 20:59  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Brad White <b55white@gmail.com>
  1 sibling, 0 replies; 9+ messages in thread

From: Adrian Klaver @ 2023-03-06 20:59 UTC (permalink / raw)
  To: Brad White <b55white@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 3/6/23 12:48 PM, Brad White wrote:
> LOL
> 
> Joke's on me.
> 
> Here's the relevant part of the view
> 
> SELECT ...
>      "Order Items"."ID" AS "OrderItemID",
>      ...
>      (("Orders"."ID" || '-'::text) || "Order Items"."ID") AS "FileKey"\

Because "Orders"."ID"  is different then "Order Items"."ID"?

> 
> Wait, then why are the Item IDs different?
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: garbage data back
@ 2023-03-06 21:27  Brad White <b55white@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Brad White @ 2023-03-06 21:27 UTC (permalink / raw)
  To: ; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

In that picture, it's clear what is happening.
Here, again, is the result that had me stumped.
[image: image.png]
What threw me was that the field I was looking for had the format of 6d-4d
and this field appeared to have the same format.
But once you expand it, you can see that it has a 6d-7d format and isn't
the field I'm looking for at all.  I was trying to take a shortcut by
finding the data in the table instead of digging in and looking up what
field was used in the report. And it appeared at first that I had found
it.  ¯\_(?)_/¯

On Mon, Mar 6, 2023 at 2:54 PM David G. Johnston <david.g.johnston@gmail.com>
wrote:

> On Mon, Mar 6, 2023 at 1:48 PM Brad White <b55white@gmail.com> wrote:
>
>> LOL
>>
>> Joke's on me.
>>
>> Here's the relevant part of the view
>>
>> SELECT ...
>>     "Order Items"."ID" AS "OrderItemID",
>>     ...
>>     (("Orders"."ID" || '-'::text) || "Order Items"."ID") AS "FileKey"
>>
>> Wait, then why are the Item IDs different?
>>
>> Here are the results again, with the FileKey field expanded a bit.
>> [image: image.png]
>>
>
> I don't understand what you are questioning...FileKey is a hyphenated
> concatenation of the ORDER Id and the ORDER ITEM Id, while OrderItemID is
> just the later - and the suffix of the former matches the later.
>
> David J.
>

Attachments:

image.png (image/png, 7.3K) download view image
image.png (image/png, 5.7K) download view image
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: garbage data back
@ 2023-03-06 21:56  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Brad White <b55white@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Adrian Klaver @ 2023-03-06 21:56 UTC (permalink / raw)
  To: Brad White <b55white@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 3/6/23 1:27 PM, Brad White wrote:
> In that picture, it's clear what is happening.
> Here, again, is the result that had me stumped.
> image.png
> What threw me was that the field I was looking for had the format of 
> 6d-4d and this field appeared to have the same format.
> But once you expand it, you can see that it has a 6d-7d format and isn't 
> the field I'm looking for at all.  I was trying to take a shortcut by 
> finding the data in the table instead of digging in and looking up what 
> field was used in the report. And it appeared at first that I had found 
> it.  ¯\_(?)_/¯

psql is your friend.




-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: garbage data back
@ 2023-03-07 19:30  Brad White <b55white@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Brad White @ 2023-03-07 19:30 UTC (permalink / raw)
  To: ; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

David,

Thanks!
'EXPLAIN ANALYZE' is very slick.
Promises to be very helpful.
As soon as I saw the output, it was obvious where my problem was.

Brad.

On Mon, Mar 6, 2023 at 2:30 PM David G. Johnston <david.g.johnston@gmail.com>
wrote:

> On Mon, Mar 6, 2023 at 1:18 PM Brad White <b55white@gmail.com> wrote:
>
>>
>> As you can see here, when attempting to filter on the FileKey, it is
>> actually filtering on the Order Item ID field.
>>
>> select "FileKey", "OrderItemID" from "vw_rptInvc_Permits"
>> where "FileKey" LIKE '%1317'
>>
>> I'm stumped. Any guesses?
>>
>
> Agreed, what you've shown doesn't make sense.
>
> Try:
> EXPLAIN ANALYZE
> REINDEX (on any underlying table indexes)
>
> Show the version you are running.
>
> David J.
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2023-03-07 19:30 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 20:17 garbage data back Brad White <b55white@gmail.com>
2023-03-06 20:23 ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-03-06 20:48   ` Brad White <b55white@gmail.com>
2023-03-06 20:54     ` David G. Johnston <david.g.johnston@gmail.com>
2023-03-06 21:27       ` Brad White <b55white@gmail.com>
2023-03-06 21:56         ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-03-06 20:59     ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-03-06 20:29 ` David G. Johnston <david.g.johnston@gmail.com>
2023-03-07 19:30   ` Brad White <b55white@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox