SELECT y.bib,
y.authority
FROM ( SELECT DISTINCT $1 AS bib,
- BTRIM(remove_paren_substring(x))::BIGINT AS authority
+ BTRIM(remove_paren_substring(txt))::BIGINT AS authority
FROM explode_array(oils_xpath('//*[@code="0"]/text()',$2)) x(txt)
- WHERE BTRIM(remove_paren_substring(x)) ~ $re$^\d+$$re$
+ WHERE BTRIM(remove_paren_substring(txt)) ~ $re$^\d+$$re$
) y JOIN authority.record_entry r ON r.id = y.authority;
SELECT $1;
$func$ LANGUAGE SQL;
SELECT y.bib,
y.authority
FROM ( SELECT DISTINCT $1 AS bib,
- BTRIM(remove_paren_substring(x))::BIGINT AS authority
+ BTRIM(remove_paren_substring(txt))::BIGINT AS authority
FROM explode_array(oils_xpath('//*[@code="0"]/text()',$2)) x(txt)
- WHERE BTRIM(remove_paren_substring(x)) ~ $re$^\d+$$re$
+ WHERE BTRIM(remove_paren_substring(txt)) ~ $re$^\d+$$re$
) y JOIN authority.record_entry r ON r.id = y.authority;
SELECT $1;
$func$ LANGUAGE SQL;