Skip to content
Advertisement

Tag: postgresql

Cannot rollback while a subtransaction is active – Error 2D000

I have written a stored procedure that basically loops over an array of fields and performs some manipulation in the db for each iteration. What I want to achieve is, either all the iterations of loops should occur or neither one of them should occur. So let’s say there were 5 elements in the fields array and the loop iterates

Full text search failure on PostgreSQL

I have a PostgreSQL used to index text content. The SearchVector column is created successfully using the following code The content looks like the following: But if I try to run a query to get plurals or singular of manual (in Italian: manuale is one, manuali are 2 or more) it fails: return nothing return nothing It only returns the

Generate random pairs SQL

Suppose we have these two tables. TABLE1: TABLE_2: I want to pair all rows of TABLE_1 with some random columns from TABLE_2 where each pair is gonna have a random amount of distinct rows from TABLE_2 (range 1,2,3) An output could be: Answer did the thing for me.

Filtering in count function – Postgresql

I have the following query which gives me the amount of referrals users have. However, I would like to only count the referral if the referred user has activated the premium plan. How could this be achieved? Dbfiddle here. I am using PostgreSQL version 14. Answer You can try to use FILTER clause or condition aggregate function. Edit From you

Advertisement