V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
fivee
V2EX  ›  问与答

postgresql 如何在函数中使用系统环境变量?

  •  
  •   fivee · 2022-08-31 20:35:08 +08:00 · 395 次点击
    这是一个创建于 625 天前的主题,其中的信息可能已经有所发展或是发生改变。
    使用 hashids 的 psql 插件
    https://github.com/iCyberon/pg_hashids

    如下语句
    SELECT id_encode(1234567, 'salt', 10);

    有办法让'salt'通过环境变量读取吗?

    因为 salt 在业务代码里也需要用,想通过环境变量一次定义就可以了。
    nine
        1
    nine  
       2022-09-01 05:18:38 +08:00
    随便定义啊,业务代码读取环境变量不就行了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   994 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 22:29 · PVG 06:29 · LAX 15:29 · JFK 18:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.