public inbox for [email protected]  
help / color / mirror / Atom feed
How to do an update with XML column ?
2+ messages / 2 participants
[nested] [flat]

* How to do an update with XML column ?
@ 2024-12-16 16:07 celati Laurent <[email protected]>
  2024-12-18 12:39 ` Re: How to do an update with XML column ? Francisco Olarte <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: celati Laurent @ 2024-12-16 16:07 UTC (permalink / raw)
  To: pgsql-general

Dear all,
I'm taking the liberty to ask an question. Do you know if there are some
ways in order to update and/or do group by with an XML column ?
For instance,

select id, unnest(xpath(
        '//cit:CI_Organisation/cit:name/gco:CharacterString/text()',
       CAST(data AS XML),
        ARRAY[
            ARRAY['cit', 'http://standards.iso.org/iso/19115/-3/cit/2.0';],
            ARRAY['gco', 'http://standards.iso.org/iso/19115/-3/gco/1.0';],
            ARRAY['mdb','http://standards.iso.org/iso/19115/-3/mdb/2.0';],
            ARRAY['cat','http://standards.iso.org/iso/19115/-3/cat/1.0';],
        ])) as orga_name, changedate, createdate, displayorder,
doctype, extra, popularity, rating, root, schemaid, title, istemplate,
isharvested, harvesturi,
       harvestuuid, groupowner, metadata.owner, metadata.source, uuid
from public.metadata
group by orga_name


I obtained :

ERROR:  could not identify an equality operator for type xml
LINE 39: group by orga_name
                  ^

SQL state: 42883
Character: 2556


Thanks so much


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

* Re: How to do an update with XML column ?
  2024-12-16 16:07 How to do an update with XML column ? celati Laurent <[email protected]>
@ 2024-12-18 12:39 ` Francisco Olarte <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Francisco Olarte @ 2024-12-18 12:39 UTC (permalink / raw)
  To: celati Laurent <[email protected]>; +Cc: pgsql-general

Hi:

On Wed, 18 Dec 2024 at 11:00, celati Laurent <[email protected]> wrote:

> ERROR:  could not identify an equality operator for type xml
> LINE 39: group by orga_name
>                   ^

Have you tried the obvious group by cast(orga_name as text) ? Never
used XML but most types in postgres convert to text injectively ( but
not bijectively ) ( I mean, same values, same text, but you can have
different text same values ( like the obvious text->float conversion
))


Francisco Olarte.






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


end of thread, other threads:[~2024-12-18 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-16 16:07 How to do an update with XML column ? celati Laurent <[email protected]>
2024-12-18 12:39 ` Francisco Olarte <[email protected]>

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