[HN Gopher] Show HN: PLJS - JavaScript for Postgres
       ___________________________________________________________________
        
       Show HN: PLJS - JavaScript for Postgres
        
       PLJS is a new, modern JavaScript trusted language extension,
       bundling QuickJS, a small and fast JavaScript runtime with
       Postgres, providing fast type conversion between Postgres and
       JavaScript, fast execution, and a very light footprint.  Here are
       bencharks that show how it compares to PLV8:
       https://github.com/plv8/pljs/blob/main/docs/BENCHMARKS.md  This is
       the first step toward a truly light-weight, fast, and extensible
       JavaScript runtime embedded inside of Postgres. The initial roadmap
       has been published at
       https://github.com/plv8/pljs/blob/main/docs/ROADMAP.md  You can
       join the discussion by joining the PLV8 Discord:
       https://discord.gg/XYGSCfVNBC  You can find PLJS at
       https://github.com/plv8/pljs
        
       Author : jerrysievert
       Score  : 7 points
       Date   : 2025-06-25 19:36 UTC (3 hours ago)
        
       | timz wrote:
       | Amazing.. Would be nice to have something like that for Redis to
       | replace Lua
        
       | phartenfeller wrote:
       | Interesting. This is now the second DB next to Oracle[1] that can
       | do JS (that I know of). pgSQL and PL/SQL of course still stay
       | relevant but in the Oracle spehere the argument is that you can
       | reuse existing code from NPM. Like this blog post [2] describes
       | how to run an GraphQL endpoint from within the DB.
       | 
       | [1] https://docs.oracle.com/en/database/oracle/oracle-
       | database/2... [2]
       | https://blogs.oracle.com/developers/post/creating-a-graphql-...
        
         | jerrysievert wrote:
         | PLV8 (the predecessor to this project) was released in June of
         | 2012. It provided JavaScript as a trusted language extension to
         | Postgres 9.2.
         | 
         | PLJS is a newer generation.
        
       | oulipo wrote:
       | What would be the typical use-case? Light data transformation?
       | 
       | Is there a significant advantage over Rust-based embedded
       | Postgres language like https://github.com/tcdi/plrust which is
       | compiled and a bit more type-safe?
        
         | tehlike wrote:
         | A lot of logic just becomes easier with javascript. If you have
         | complex-ish trigger logic, or a procedure etc - doing these in
         | pl/pgsql is just hard if not intracatable. Also allows up reuse
         | of a lot of code that people have built with npm - even if not
         | directly with require(), it becomes possible to bundle compiled
         | binary.
         | 
         | I used this for storing patches of data (to save space,
         | compression is a pain in Postgres) and applying runtime to show
         | full version etc. It's fun.
        
       ___________________________________________________________________
       (page generated 2025-06-25 23:01 UTC)