Skip to content
Advertisement

Tag: postgresql

UPDATE with RETURNING: Not able to retrieve ResultSet

I’ve tested the following UPDATE-RETURNING statement in my PostgreSQL client, and it correctly updates and returns the updated rows. However, in Java, I’m not able to retrieve the ResultSet. statement.execute() and statement.getMoreResults() always return false and statement.getResultSet() returns null, always. Am I missing something here? Answer Well, I wasn’t really able to solve this properly. However, I ended up using

Postgresql: join readonly database with csv-file

The task is to join data from local cdv-file with data from remote database. On this database I have readonly writes. So I can’t create new tables in this db. Only recommended way (which I have found) to do this is to: 1. Create new table in db 2. Copy (import) content of csv-file in this new table. 3. Make

Iterating multiple times over same table (postgres sql)

i am working with sql from few days as beginner and stuck at a problem! Problem: Given A table user_email_table which columns are (id, user_id, user_id_email) How to get all user co-related to each and every user extending himself user_email_table Desired Output Please Ignore validate data of email fields This are just for reminding to mention these columns in output-table

How to group rows by the date part of a timestamp column?

There is a table having timestamp column : I want to get all rows and the sum of the duree_seconde column based on the date part of the connexion column ; that means I want to sum all the duree_seconde column values for each same day, for example if there are data like this : how can I get the

How to fix NEXTVAL returning null in insert query but returns correct value when executed alone in PostgreSQL?

When I execute the following insert query: I get the following output: The third column which is supposed to be filled by the NEXTVAL function result is being sent null, which is violating a certain non-nullity constraint. However when I execute NEXTVAL independently like this: The function returns a correct value as shown below in the screenshot: Answer Your insert

Access Bare Columns w/ Aggregate Function w/o adding to Group By

I have 2 tables in postgres. users auth0_id email 123-A a@a 123-B b@b 123-C c@c auth0_logs id date user_id client_name abc-1 021-10-16T00:18:41.381Z 123-A example_client abc-2 … 123-A example_client abc-3 … 123-B example_client abc-4 … 123-A example_client abc-5 … 123-B example_client abc-6 … 123-C example_client I am trying to get the last login information (a single row in the auth0_logs table

Advertisement