Skip to content
Advertisement

Tag: postgresql

Insertion by removing ‘000000’ in the unix timestamp

I’m inserting some data for python that comes from a GET in API FLASK like JSON, for some reason when python will insert this data or maybe postgres itself, it is removing the 000000 Data json: Insert py: Original date: Date that python is inserting to pgsql: Conversion correct: Even using the website’s timezone, it returns with a problem select

Return only one row in subquery

I have the following query that I’m executing to show these records on a Laravel view. I’m having issues with this line Because there are a lot of cities with the same name in my database, so it’s throwing an error, (probably the same with states but the error is being thrown at cities in this case, I tried to

Fixing set-returning functions are not allowed in UPDATE

After upgrading to Postgres 12 statement throws error set-returning functions are not allowed in UPDATE How to fix this ? In Postgres 9.1 it worked. I read similar answers here but they recomment to totally overwrite statement. Maybe there is simply change which makes this statement work ? Result should by any value of xpath expression in case if xpath

how can i get the sum of two colums realtime

i have the following I want to have something like that select *, a+b as mes from maths; but to have a column sum and evrytime the columns a and b get update calculate the new sum in columns sum i try this and i get the following error Answer The syntax for generated column in PostgreSQL is: Demo: https://dbfiddle.uk/?rdbms=postgres_12&fiddle=7f328dbdb991e68b46a8292bf7c480ab

Simple Postgres query returning no result

I have two tables: and I have indexes on id in both tables, and an index on website_id and product_id on the adjustments table. This query returns data but it takes some 5 seconds with some 1k products and a couple hundred in adjustments: This other query however returns no results when there’s nothing in the adjustments table: Was it

Advertisement