【问题标题】:knex returning empty result when using regex_matches使用 regex_matches 时 knex 返回空结果
【发布时间】:2022-10-04 16:40:46
【问题描述】:

尽管生成的 SQL 返回正确的结果集,但在使用 regex_matches 时 knex 返回空结果。使用 knexv2.3.0 和 pg8.2.1。

IE。

knex("v_domains").select("domain_uuid", knex.raw("(REGEXP_MATCHES(domain_description, 'rid:(.*?)//'))[1] as reseller_id")).debug(true)

{ 方法:'选择', 选项: {}, 超时:假, 取消超时:假, 绑定:[], __knexQueryUid: 'ROyC62-HHob0AiJzffMee', sql:select "domain_uuid", (REGEXP_MATCHES(domain_description, 'rid:(.*?)//'))[1] as reseller_id from "v_domains" }

对此的任何帮助将不胜感激:)

【问题讨论】:

    标签: node.js postgresql knex.js


    【解决方案1】:

    好的,我找到了答案。知道自己浪费了多少时间试图弄清楚这一点,我感到有点沮丧。孩子累了就不要写代码了。 ;)

    const test = await knex("v_domains").select("domain_uuid", knex.raw(" 
    (REGEXP_MATCHES(domain_description, ?))[1] as reseller_id", ['rid: 
    (.*?)//'])).debug(true);
    

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 2022-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多