Subject Re: [firebird-support] Re: Duplicates with LIST function in Fb 2.5.4?
Author Svein Erling Tysvær
Thanks Dmitry, learning that the problem is with blobs and not particularly LIST, DISTINCT or UNION helped me realise that the simple workaround is to use cast(list(<field>) as varchar(<size>)) whenever I want to return distinct values of blobs.

Set

2016-01-11 14:31 GMT+01:00 Dmitry Yemanov dimitr@... [firebird-support] <firebird-support@yahoogroups.com>:
11.01.2016 11:49, Svein Erling Tysvær wrote:

> Hi, I'm puzzled by two queries returning duplicate rows:
>
> 1)
> SELECT LIST('Hi') FROM RDB$DATABASE
> UNION
> SELECT LIST('Hi') FROM RDB$DATABASE
>
> 2)
> WITH TMP(DuplicateRows) AS
> (SELECT LIST('Hi') FROM RDB$DATABASE
>   UNION
>   SELECT LIST('Hi') FROM RDB$DATABASE)
> SELECT DISTINCT DuplicateRows
> FROM TMP

LIST returns a blob. DISTINCT doesn't work with blobs properly, it
operates with blob ids (that are surely distinct) instead. See:

http://tracker.firebirdsql.org/browse/CORE-1345
http://tracker.firebirdsql.org/browse/CORE-1530


Dmitry




------------------------------------
Posted by: Dmitry Yemanov <dimitr@...>
------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-digest@yahoogroups.com
    firebird-support-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/