Click here to Skip to main content
15,891,513 members
Everything / Database Development / PostgreSQL

PostgreSQL

PostgreSQL

Great Reads

by Evoluteur
Generic REST or GraphQL endpoints for CRUD and more, written in JavaScript, using Node.js, Express, and PostgreSQL
by RickZeeland
PostgreSQL notifications Windows Forms application
by Arthur V. Ratz
Create a Python web-app using Flask and PostgreSQL server, and run it in Docker
by dsuryd
Combine PostgreSQL logical replication feature with dotNetify to broadcast data changes to your website in real-time

Latest Articles

by GabrieleTronchin
A simple implementation of MartenDB. MartenDB is a .NET Transactional Document DB and Event Store on PostgreSQL. For more information about MartenDB
by Farzad Niknam B
Web app creation using .NET 7.0 and ASP.NET Core
by JBartlau
This article demonstrates how Report Server offers a distribution of reports that save time, increase efficiency, and reduce potential errors.
by Jeffrey T. Fritz
Migrate Azure Postgres database to a Flexible Server

All Articles

Sort by Updated

PostgreSQL 

11 Apr 2024 by Andre Oosthuizen
Based on the comments and Pete's solution - -Everything depends on whether you have a relation between the 2 tables - Primary and Foreign keys, in your case the 'building_id'. from both tables. -Store the values as a '0' which will return a false...
11 Apr 2024 by Ebrar Çağdaş
Im new in SQL but I learn solo. So I need help... What should I do to prevent integers with NULL values from being included in my query? Im working on swiss_apartments DB it has 2 columns . 1. Locations (Integer) 2. Simulations (boolean) I want...
11 Apr 2024 by Pete O'Hanlon
Is there any link between these two tables? This is known as a relationship. An example of this might be something like: I build electric guitars so I have a table that contains a list of all the guitars. Each guitar has pickups, so I have a...
7 Apr 2024 by Office Systems
'm getting this error java.lang.IllegalStateException: Calling [asyncPostProcess()] is not valid for a request with Async state [ERROR] in an API gateway when I'm executing order-service which uploads more than 700,000 records fetched from an API...
31 Mar 2024 by GabrieleTronchin
A simple implementation of MartenDB. MartenDB is a .NET Transactional Document DB and Event Store on PostgreSQL. For more information about MartenDB
19 Mar 2024 by Pete O'Hanlon
Without knowing where you were sourcing your data, this is an almost impossible question to answer. There are a few things that do occur from looking at this. You are adding a random UUID but that could easily be auto-generated by the database....
19 Mar 2024 by OriginalGriff
Nobody can guarantee you "a fraction of a second" to add a million rows to a DB, PostgreSQL or not - it will depend on far too many factors: the computer(s) that the DB engine is running on, the activity level on the DB, the connection between...
18 Mar 2024 by Office Systems
I'm having an array list which has more than 1 million of records in it, I want to dump it as the way it is in PostgreSQL database using something built in methods like Copy-manger or any method which will be more faster to import this large...
29 Jan 2024 by Peter_in_2780
Your array_fill() is the culprit. Take a look at what you are putting after VALUES ( implode(',',array_fill(0,count($col),implode(',', $input))) It's effectively evaluated right to left because of the nested function calls, so take the first...
29 Jan 2024 by Nicholas Lombardi
I have a form where I expect many blank input text boxes (standard html) I need to insert records, with the INSERT statement ignoring those fields which do not have input values. For context, I take the POST variables in the usual way: if...
30 Dec 2023 by Dave Kreskowiak
I don't know Kotlin at all, but it seems you're catching an exception but completely ignoring it, only returning a generic response: } catch (e: Exception) { // Handle registration errors call.respond(HttpStatusCode.BadRequest,...
30 Dec 2023 by Carlos Ramos Dec2023
I am doing a backend server and I am having some trouble while testing /register route. I think that I have configured everything correctly but it gives me the 406 error when I try to do a POST method on Postman this is the link that I am using...
4 Dec 2023 by Richard Deeming
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation/interpolation to build a SQL query. ALWAYS use a parameterized query. Fix that, and you'll also fix your error. cmd.CommandText = "INSERT INTO mps_errorlog (idError,...
4 Dec 2023 by invisible@123
i am trying to insert value in error log in postgre INSERT INTO errorlog (idError,iduser,strMessage,xmlError) this are coulmn value in strmessage conatin 6307d86b-8af9-41bf-a686-a84a86373703', '', '', '12/5/2023 7:44:51 AM',...
27 Oct 2023 by Office Systems
I'm fetching data from Microsoft access database file into PostgreSQL Database, then later some changes are added into Microsoft access database file and then re-uploaded into PostgreSQL Database as the latest dataset file with changes, now the...
27 Oct 2023 by Kanchana Gallage
I am doing implementation for this type of SELECT query in a Spring boot application using named parameter jdbc template. Database used is postgres. SELECT lp.*, gp.NAME, gp.description, FROM global_products gp...
27 Oct 2023 by Richard Deeming
Quote: Adding ORDER BY clause gives the similar order and data every time but I do not need that for the requirement. Except you do need that. If you don't specify an explicit order for the results, then the order is undefined. The DBMS is...
26 Oct 2023 by Gerry Schmitz
Add a "timestamp" to the Access records; and use a new timestamp when you update and insert. You can't "delete" initially; you'll need to add a "delete" flag (and timestamp) so you can export "deleted" records; and purge / archive them later. You...
14 Sep 2023 by Dave Kreskowiak
It's because you're Filename path is wrong. There should be a space between "Program" and "Files". info.FileName = @"C:\Program Files\PostgreSQL\9.6\bin\pg_dump.exe"; ^
14 Sep 2023 by odimaxxx
I want to store locally my Postgres database (.backup) using Winform C#. What I have tried: string cmd = "-i -h localhost -p 5432 -U postgres -F c -b -v -f " + "@D:\\DatabaseBackupGrabberDaily\\" + "iis_live" + ".backup "; ...
23 Aug 2023 by OriginalGriff
We can't tell: we have no access to your system to see what might be going on - and your command requires files in specific places which may not be valid for anyone else's PC. So it's going to be up to you - I'd start by removing this line:...
19 Aug 2023 by Farzad Niknam B
Web app creation using .NET 7.0 and ASP.NET Core
16 Jul 2023 by Naresh Barule
We have an RDS instance hosted for Aurora PostgreSQL, specifically using the 'db.r5.xlarge' instance type. When we initially set up the RDS instance, a default user named 'rdsadmin' was automatically created with the 'SUPERUSER' role. During the...
4 Jul 2023 by Office Systems
I'm trying to fetch data using Spring Boot for my REST API from PostgreSQL Database, I have more than 30 million records in my database, the API takes a lot of time to pull data from the database and sometimes it results on time out error when...
4 Jul 2023 by Richard Deeming
Quote: I just want to count the results I can't return such data to the user there is no means I can count these values depending on these conditions provided Your code is loading all 4 million matching records into a list, simply to return...
15 May 2023 by Om Language Studio German Language House
SELECT product_id, SUBSTRING (product_id FROM 0 FOR 3) AS First_Part, SUBSTRING (product_id FROM 5 FOR 2) AS Second_Part, SUBSTRING (product_id FROM 8 FOR 8) AS Last_Part FROM product; What I have tried: I used this query to get the product...
15 May 2023 by Maciej Los
Accordingly to the documentation (PostgreSQL: Documentation: 9.1: String Functions and Operators[^]): substring('Thomas' from 2 for 3) --returns: hom Conclusion: your query is incorrect.
31 Mar 2023 by User 15929814
I am a beginner and Im trying to connect the dots and learn, my aim is to get the input values and post them to postgresql database as post request. My code so far. What I have tried: import { useState, useEffect } from "react"; import axios...
20 Feb 2023 by Richard MacCutchan
See Learn about building, deploying, and managing your apps on Heroku.[^]
20 Feb 2023 by Agnib Pyne 2022
Hi All, I have developed a web application using .Net Core API, Angular and PostgreSQL. Also, a whatsapp chatbot has been developed using Python, Twilio and MongoDB. Now, I want to deploy these for client use and planning to host these in...
15 Feb 2023 by OriginalGriff
This is the same question you posted yesterday: Reutring incorrect data from database[^] and the answer hasn't changed: you need to use the debugger to find out exactly what is in the DB and how that differs from what your code expects. So I...
15 Feb 2023 by Mohamad Simo
Hi In the below code, when I run it and input the values as it's in the PostgreSQL database it's showing 'Invalid password' in client's table where it's totally correct.
14 Feb 2023 by OriginalGriff
How do you know it is correct? What value did you store in the DB? How did you store it? What value is returned by the SELECT? Do the rows even exist? Are you even connected to the correct database? You need to look at exactly what is happening...
14 Feb 2023 by Mohamad Simo
Hi, I am not master with PHP, but what i am trying to do is creating login form and i am getting this error message: Warning: Undefined variable $conn in C:\xampp\htdocs\BeravaPhp\phpfiles\login_ini.php on line 10 Fatal error: Uncaught Error:...
14 Feb 2023 by Andre Oosthuizen
$conn has never been declared, it should be $pdo, which has been declared, as per your function.
14 Feb 2023 by OriginalGriff
The error is self explanatory: the variable $conn does not exist. The code you show only uses $conn - it does not at any point declare it and assign it a value:$stmt = $conn->prepare("SELECT * FROM Clients WHERE CUID = :cuid"); $stmt =...
3 Feb 2023 by JBartlau
This article demonstrates how Report Server offers a distribution of reports that save time, increase efficiency, and reduce potential errors.
21 Dec 2022 by Jeffrey T. Fritz
Migrate Azure Postgres database to a Flexible Server
19 Dec 2022 by Sergei Y.Kitáev
Introduction to statically parameterized SQL language
8 Dec 2022 by Jerome Vonk
Granola is a web app for tracking your expenses with custom categories, reports and charts
28 Nov 2022 by Eva Smirnova
Hello everyone and again I In my SQL terminal, the shell shows scribbles instead of words, you need to set up the encoding, but I don’t know how, I work on windows 11 What I have tried: I don’t know what to do here, I tried to google but...
28 Nov 2022 by Maciej Los
Well... Use UTF-8 database encoding. See: PostgreSQL: Documentation: 15: 24.3.�Character Set Support[^] Then you'll be able to insert text there in any collation. More here: MySQL to PostgreSQL | UTF-8 all the way through[^]
23 Nov 2022 by Eva Smirnova
import uuid from django.db import models from django.core import validators from django.contrib.auth.models import User from django.db.models.base import Model from django.db.models.deletion import SET, SET_NULL from...
23 Nov 2022 by Richard MacCutchan
The message is telling you that the database could not find a Book record with a pk of 1. Check the contents of the database tables to see exactly what it does have.
22 Nov 2022 by Eva Smirnova
Why does it underline the code as an error, but the code itself works, the server starts up and there are no errors, but in problems 31, what is wrong in the code? from django.contrib import admin from web_lib.models import Author, Book,...
22 Nov 2022 by Eva Smirnova
import uuid from django.db import models from django.core import validators class Author(models.Model): class Meta: verbose_name = 'Автор' verbose_name_plural = 'Авторы' ordering = ['id'] unique_together =...
22 Nov 2022 by Richard MacCutchan
Add a default parameter to the name field in your Author class thus: name = models.CharField(verbose_name='Имя автора', default='no name', max_length=200, validators=[validators.RegexValidator(regex='^.*em$', message='Wrong')])
22 Nov 2022 by CHill60
When you press '1' it should be asking you for the default value to apply. Ctrl-C will terminate your program without further processing taking place. Quote: So how should this be fixed? You have several options: 1. Change the database so that...
1 Nov 2022 by Tomas@PawSQL
How to cope with all scenarios regarding NULL value handling in your daily work
21 Sep 2022 by salam_verdim_alana_panyatkasi_olana
I have two table A and B. A table has fk_B_id and I want to insert data to A Table but B table is empty. When I insert to A table postgresql shows me that null value in column violates not-null constraint. is there any way where I insert data to...
21 Sep 2022 by Richard Deeming
No. If the column doesn't allow nulls, and has a foreign-key relationship to another table, then you have to insert a value into that column, and it has to match the primary key of a record in the foreign table. If you want to allow nulls, then...
18 Sep 2022 by razrx
Hi I am a postgres newbie, Is there a way to get/predict the date of deadline using date posted and add just 20 days but must remove saturday and sunday in postgres. Example: posted...
18 Sep 2022 by Richard MacCutchan
See postgresql workdays - Google Search[^].
9 Jul 2022 by Member 15678123
You are looping all on all the {% for finances in viewpayout %} objects hence it's going to render multiple of course. Try below: def finances(request): totalpayout = Finances.objects.all().aggregate(Sum('payout'))['payout__sum'] or...
9 Jul 2022 by ckcRichard
currently the way I have the code written is that I have a model named Finances. I have an aggregate set up so it sums up all of the rows. I am trying to display the outcome of the rows, but when I do it displays a row for every database entry. ...
6 Jul 2022 by DiponRoy
Quick start example to run DB and clients in docker
4 Jul 2022 by DiponRoy
How to auto increment column options in databases
28 Jun 2022 by DiponRoy
How to use MERGE statements in different databases
19 May 2022 by André Marcos (Advisor), GracianoSouza
React Native, Node.js and PostreSQL, a PERN stack to develop an app to support the lost pets searching process
12 May 2022 by Patrice T
Quote: Biggest challenge is the space delimeter as all rows are not identical for ex It is not a challenge as space have multiple usage in your addresses, it is a bad idea, it is impossible. You have devised this RegEx...
11 May 2022 by Evoluteur
Generic REST or GraphQL endpoints for CRUD and more, written in JavaScript, using Node.js, Express, and PostgreSQL
10 May 2022 by Member 14019423
Hi All, Problem statment is as described in the headline Using postgresql Example value in "Address"column 4 drive rd phoneix Arizona 34445 Needs to be extracted into differaent columns as Addressline,State,City,Zipcode Biggest challenge is...
10 May 2022 by Maciej Los
There's a chance to split address data into parts using regex[^]. Assuming that, last 3 pieces of address column are: - postal abbrevation: 2 letters, - city: one or more words, - zipcode: 5 digits you'll be able to split address into parts. ...
8 May 2022 by OriginalGriff
Don't. You can't really automate that successfully without having a lookup table for each possible address in the country. For example, where do you break "peach pine road lake havasu city arizona" that gives you three segments "peach pine road",...
4 May 2022 by koter kong
I have the following data structure: CREATE TABLE test_table( id int8 PRIMARY KEY, patientid VARCHAR(255) NOT NULL, studyid VARCHAR(255) NOT NULL, gid VARCHAR(255) NOT NULL, labels int8, timestamp TIMESTAMP ); With the following data: ...
4 May 2022 by CHill60
The only thing wrong with your code is testing for rank
30 Apr 2022 by Member 13937944
Hello, I have created an exercise on which one column has words and the second column has the pronounce. The second column is shuffled. The code which shows the results is: while($row = pg_fetch_array($ideo_results)){ $pinyin_query = "select...
30 Apr 2022 by Member 13937944
I had to change two lines: var getIdeo = $('input[name="ideogram"]:checked').val(); var getPin = $('input[name="pinnin"]:checked').val();
21 Mar 2022 by User 14717878
I want to see what is query id value, but in pgAdmin shows only $1. Photo shows how it looks. Capture.PNG | Failiem.lv.[^] Code looks like: // Savienojums ar datu bāzi. readonly string CS =...
21 Mar 2022 by RickZeeland
Maybe you can use the log_statement config setting, see: PostgreSQL: Documentation: 14: 20.8.�Error Reporting and Logging[^] If you are not afraid of Perl (I am :) you might try pgBadger :: PostgreSQL log analyzer[^] And here is an overview...
7 Jan 2022 by Member 15489491
This is the query I have written: select c.id, CONCAT(c.major_version, '.', c.minor_version) as versions from event_ids c where c_id in ('101') group by c_id, major_version, minor_version; This is the result I am getting |id | versions|...
7 Jan 2022 by CHill60
Which ever "structure" you use to display the results you cannot get away from the fact that the query will return your data as |id | versions| |----|-------- | |101 | 0.0 | |101 | 1.0 | |101 | 2.0 | |101 | 3.0 | It has to,...
15 Dec 2021 by User CP
i have Postgresql DB scripts in different folders based on schema such as folder 1 => Sequences , Tables , Scripts folder 2 => Sequences , Tables , Scripts Sequences , Tables , Scripts are folders where actiol scripts exist. Now i want to...
1 Dec 2021 by Arctype SQL
In this article, you'll learn about Postgres UUIDs and how to generate them with examples from two different modules.
23 Nov 2021 by Member 15442525
I am just moving to some PostgreSQL from MS-SQL and have checked numerous pages on how to use variables in a script but am getting nowhere Within pg-admin I have my database and have a new script. I have stripped the SQL right back to a single...
23 Nov 2021 by Maciej Los
Start with Postgres documentation: PostgreSQL: Documentation: 14: 43.3.�Declarations[^] or with tutorial: Introduction to variables in PL/pgSQL[^]
23 Nov 2021 by OriginalGriff
See here: sql - How to declare a variable in a PostgreSQL query - Stack Overflow[^]
7 Nov 2021 by Corey Bailey 2021
I am bringing in data from postgres into power bi and then using that power bi app in a vue pilot rotation.. I was using an odbc connection but it is too slow so I want to do direct query. However, the server the postgres is on utc obviously....
7 Nov 2021 by RickZeeland
See answer here: Solved: Time error in data in automatic refresh - Microsoft Power BI Community[^]
20 Oct 2021 by Weird Japanese Shows
Hello guys, Whenever I need to change my pc, I'm haunted by the thoughts of rebuilding external libraries. Some libraries have step-by-step insturctions which prevents it from becoming a challenge but some libraries like libpqxx(postgresql's c++...
20 Oct 2021 by Rick York
I use VS19 also and I make libraries all the time, no pun intended. Portability to other environments is of zero concern for me so I just use VS19's built-in settings to make it happen. I select a configuration type of static library which is...
20 Oct 2021 by Richard MacCutchan
This is the Quick Answers forum, and there is nowhere near enough space (or time) to provide product tutorials. You will need to find them for yourself. For example: CMake Reference Documentation — CMake 3.22.0-rc1 Documentation[^], make(1) -...
15 Oct 2021 by Weird Japanese Shows
Hello, I'm currently developing an online game server(and the game itself) but I'm facing a difficulty. If the game becomes popular and there are a million characters created(used and unused. there will always be characters not used by anyone...
15 Oct 2021 by KarstenK
The in memory operation is an excellent idea, but also try to optimize your code. Your string building in the exec statement isnt good. Better is too use one sprint or even better use all information as strings and so avoid type casting. Also use...
15 Oct 2021 by Member 15329613
1. It would be faster to do the update in SQL, rather than pull all records into C++ and rewrite the data to the database. 2. If you are going to stick with C++, do not do SELECT *. Select just the specific field(s) you need. 3. Some games...
15 Oct 2021 by Greg Utas
Let's say you have 1M characters and that each character requires 1KB of data. That's still only 1GB, so just shadow the entire database in memory and only do commits when necessary. Frequently re-importing the data after asking the database to...
2 Oct 2021 by User-11630313
I knew the primary key constraint does not allow the duplicate values..but i seen that duplicate values in primary key column in my application old database...how is it possible?
24 Sep 2021 by Richard MacCutchan
The only way to make any progress is learn the technology, and practice, practice, practice. A good place to start is Java Tutorials Learning Paths[^].
13 Sep 2021 by tijojoseph1989
What is the best way to migrate Oracle Package to PostgreSQL What I have tried: Thinking of creating procedures with package name as prefix.
13 Sep 2021 by Wendelius
PostgreSQL does not have a similar object type as a package in Oracle so you need to break the package into separate procedures and functions. What comes to the naming, I don't see any specific reason to retain the name of the package as a prefix...
13 Sep 2021 by RickZeeland
As it says here: The Complete Oracle to PostgreSQL Migration Guide: Move and convert Schema, Application & Data[^] Quote: PostgreSQL does not have packages but using schema architecture, functions and procedures can be grouped. Use the “orafce”...
25 Aug 2021 by mukesh mourya
In my case,I want to get last 6 months records from the current date using squelize query in the node and want to group by number of records of each month.please help meWhat I have tried:I want to get last 6 months records from the current date using squelize query in the node and...
8 Aug 2021 by light93
If user created an account, he can choose his languages, we have two tables: 1. languages: language_id, language_name 2. user_languages: user_id, language_id If the user chose languages already exists, we will add it to the 'user_languages'...
4 Aug 2021 by dsuryd
Combine PostgreSQL logical replication feature with dotNetify to broadcast data changes to your website in real-time
26 Jul 2021 by Hayk Baghdasaryan
Let's say we have a Car model which consists of Parts (engine, exhaust pipe, tires etc.), and then each part has SmallPart (engine has cylinders, water pump, oil filter etc). The client sends all this in an object with nested keys. In this case...