The only time I encountered a similar problem on SO is on here, but the proposed solution was not relevant for me. I call a PostgreSQL function, but it’s returning a single value instead of one value per field, which I can access. I have a table “Words”, which consists of a primary key word …
Tag: sql
Symfony 5 – “An exception occurred in driver: could not find driver”
I’m currently face to this problem. I am really new beginer at Symfony. Problem : When i create a new db with cli symfony console doctrine:database:create, i am getting these errors : Iam using php 7.4 with xampp and normaly pdo_sql is installed : this is my .env file config : And this is my doctrine.ya…
Creating primary key in postgresql takes days
I am trying to write my table to a PostgreSQL database then declare a primary key. My data is really huge (includes billions of rows and total size is approximately 150 GB), when I try to create a primary key after writing the table, it takes forever. Here is how I define the primary key; I am %101 sure about
How to store user content while avoiding XSS vulnerabilities
I know similar questions have been asked but I am struggling to work out how to do it. I am building a CMS, rather primitive right now, but it’s as a learning exercise; in a production site, I would use an existing solution for sure. I would like to take user input, which can be styled in a WYSIWYG edit…
Quick way to find a word using a SQL query
My current code is to try to find 2 words “Red Table” in Title: The problem is, this is so slow! I even put the status “Index” to the column Title. I just want to search for multiple words in one (I would prefer in title AND description), but obviously I can’t use LIKE because it…
How to compare the value of one row with the upper row in one column of an ordered table?
I have a table in PostgreSQL that contains the GPS points from cell phones. It has an integer column that stores epoch (the number of seconds from 1960). I want to order the table based on time (epoch column), then, break the trips to sub trips when there is no GPS record for more than 2 minutes. I did it
adding many to many relations is producing an empty queryset
I have a model called Occurrence with a number of foreign key and manytomany relationships (i’ve only shown a few fields here). I am having issues when attempting to create any manytomany relation to an Occurrence instance after I have loaded bulk data to my postgres (postgis) database using the sqlalch…
Compare two arrays in PostgreSQL
I have a table in postgres with a value column that contains string arrays. My objective is to find all arrays that contain any of the following strings: {‘cat’, ‘dog’} The following query uses ANY() to check if ‘dog’ is equal to any of the items in each array and will corr…
Get rid of all empty strings values in jsonb | Postgres
I have rather abstract question on PostgreSQL jsonb data. For example I have a table called… table_one, where I have a column: In 100% cases in contains flat json structure like example: might be different length or null but always flat. My goal is like that. Whenever I select this column I need to somehow co…
query inside the exception and begin block in exception
Hello I want to ask what is the best practise to do. First example try to retrieve my data through exceptions I use this code in my main application and is working fine but I dont know if its good practise to code inside the exceptions blocks SECOND EXAMPLE TRY TO RETRIEVE DATA WITH CASES AND SELECT WITH COUN…