2,668 questions
Advice
2 votes
2 replies
65 views
Postgres JSON or JSONB to store game's character customization data
I'm building the backend for a platform that works similarly to a game. It includes a simple character customization system with a few properties that aren't particularly relevant to the product (...
2 votes
1 answer
72 views
How to use jsonb functions in hibernate 6?
We use Postgres jsonb_agg function in criteria query API like this: cb.function( JSONB_AGG_FUNCTION_NAME, JsonNode.class, someJoin.get(someField) ...
1 vote
3 answers
108 views
SELECT jsonb data based on specific children values/properties
Assume I have many rows with jsonb data like this in their respective columns: { ..., "participants": { "one_uuid": { "id": "another_uuid", &...
2 votes
2 answers
111 views
postgres jsonb array aggregate functions
I have a table with data on user applications. It contains several fields: employee_id text, date date, app_info jsonb. +-------------+------------+------------+ | employee_id | date | app_info ...
-2 votes
2 answers
125 views
Looking for the operator that extracts the key of one of JSONB objects
Is there an operator that extracts xx from '{"xx":123}'::jsonb? In my data I always have only one key, so something like #>>'{$.*}' that meets this requirement, perhaps exists. PS: ...
1 vote
2 answers
338 views
python+asyncpg+PostgreSQL returns jsonb column as a string instead of an object
I'm new to python and just came to a problem: i've set up a simple program to fetch some data from PostgreSQL database. They say that asyncpg library automatically converts JSONB data to Python ...
0 votes
0 answers
71 views
Getting typescript error "No overload matches this call" on Postgres INSERT/UPDATE statement into JSONB column
I'm an experienced programmer (mainly c# and mysql, then moved to javascript/JQuery and now more recently nextjs), but new to nextjs and postgres. I'm trying to insert an object into a JSONB column, ...
0 votes
0 answers
95 views
How to extract JSONB array values from a Supabase Postgres table and insert them into another table in React Native?
I'm working on a React Native app with Supabase as my backend. My products table has a style_tags column in JSONB array format, for example: [ { "tag": "streetwear", "weight&...
1 vote
1 answer
51 views
How to write a query with aggregates of json_array_elements in jOOQ
I have this query: SELECT organisation_id, count((j->>'invoiceId')) AS count, sum((j->>'advanceAmount')::numeric(20,4)) AS sum FROM runs LEFT JOIN jsonb_array_elements(...
2 votes
1 answer
69 views
Postgres UPDATE table SET jsonb typed column with javascript var not work for remove an array item
I'm using this package to CRUD in a Postgres database https://github.com/porsager/postgres This is my query - it works fine to remove a index 0 or n... on a JSON array inside a jsonb column: UPDATE ...
2 votes
2 answers
115 views
Postgres UPDATE table SET jsonb_set returning invalid input syntax for type json using javascript
I'm using this package to CRUD in a Postgres database https://github.com/porsager/postgres This is my query: POSGRES_SQL`UPDATE pedidos SET destinatario = jsonb_set( destinatario, '...
2 votes
2 answers
78 views
Postgres @> operator confusion
I seem to be having issues with the @> operator: CREATE TEMP TABLE test_jsonb (id SERIAL, data jsonb); INSERT INTO test_jsonb (data) VALUES ('[{"role_id": "1", "user_name&...
0 votes
1 answer
58 views
Joining JSONB array objects to an attribute on the same object
Consider the following table: CREATE TABLE organization_data(data JSONB); And it has the following data: INSERT INTO organization_data (data) VALUES ('[{"department_name": "sales",...
2 votes
2 answers
99 views
Postgresql: jsonb_path_query filter based on value from a table column
WITH pets AS (SELECT 'Dog' AS mainpet, ' [ { "petSpecies": "Dog", "mainMeal": "Meat" }, { "petSpecies": "Cat", "...
1 vote
1 answer
98 views
npgsql call jsonb_path_exists on string mapped jsonb
I've got a table with the filed string Data { get; set; } of type jsonb: modelBuilder.Entity<LayoutEntity>(b => { b.Property(p => p.Data).IsRequired().HasColumnName("data")....