Most voted "postgresql" questions
Postgresql is an open-source, object-relational database management system (ORDBMS) available for many platforms, including Linux, UNIX, MS Windows, and macOS. Please mention your version of Postgresql when asking questions.
Learn more…1,437 questions
Sort by count of
-
0
votes0
answers60
viewsHow to get next code from a table in pgsql?
In Mysql I use the syntax SHOW TABLE STATUS LIKE 'NOME_DATABELA' How I capture the report in Postgres?
-
0
votes4
answers91
viewsSelect with columns stating incorrect data
Hello I’m having another problem with a database search. I want to make a SELECT that looks for information such as Cod.empresa, razaosocial, ano e valores(somados). At first, the search for…
-
0
votes2
answers92
viewsConnection between Node and Postgresql
I am creating a Node API for a personal project with Postgresql connection. Is there any way to migrate (so that records are automatically created in the database) from created models? I know how…
-
0
votes1
answer221
viewsPostgresql - Importing . CSV into an existing table
I have a table with three columns, which already has data, in my Postgresql. I have a file . CSV with four columns. I would like to add the data of three columns of . CSV to SQL without replacing…
-
0
votes0
answers319
viewsUpdate TIMESTAMP field in On Update Postgres
I have the following table: Create Table tb_teste( cod_key integer not null, data_cad timestamp not null default now(), data_atualizacao timestamp not null default now(), primary key(cod_key) ) In…
-
0
votes1
answer40
viewsWhat is the difference between operators <@> and <->
I was studying geometric types and coordinates in SQL, in Postgresql more specifically, and I came across two operators, the operator <@> and the operator <->. What’s the difference…
-
0
votes1
answer234
viewsConvert VARCHAR to TIMESTAMP (AWS REDSHIFT/POSTGRESQL)
I have the following problem, at source I have the data coming as varchar example of data source in varchar format: 08:15:49 18:16:05 20:01:33 etc.... I need to reinsert this data into a new table…
-
0
votes1
answer117
viewsUse composite key as PK or not?
I have two tables: 1- Contracted Service 2- Payment Contracted Service 1 service may have N payments. I modeled the Contracted Service Payment class as follows: CREATE TABLE…
-
0
votes1
answer40
viewsMake Join using a substring
How to Join two tables to check if one string contains another? Ex: In table A I have the field: AAA;BBB;CCC and in table B I have the field BBB. How to make a Join like this: select * from A join B…
postgresqlasked 4 years, 8 months ago Italo Rodrigo 4,344 -
0
votes1
answer72
viewsTrigger and another field
In postgres I have two tables, Test1(id_test1,name) and test2(id_test2, test1_id_test1, phone) In the PHP form I have the field name and phone. When I write name in Test1, a Trigger replicates the…
-
0
votes1
answer43
viewsWhat is the lowest weight direct consultation or using views for a double relationship?
Given the following schema hypothetical: create table cidade( cidade_id integer primary key not null, nome varchar(40) ); create table envios( id integer primary key not null, cidade_origem_id…
-
0
votes1
answer31
viewsFiltering results with Postgres selects
I have the following table: results idRes(int) | idEmp(int) | data(varchar[8]) | resultado(text) ------------------------------------------------------------------ 1 | 1 | 20200220 | (xml em texto)…
postgresqlasked 4 years, 8 months ago Pedro Nassetti 23 -
0
votes1
answer62
viewsPostgresql - Change multiple column names at once
I have a table in Postgresql with columns that are named "c0001", "c0992", "c3993", and so on. They start with c and then comes a "random number". I have a dictionary in . csv explaining each of…
postgresqlasked 4 years, 8 months ago RxT 995 -
0
votes2
answers118
viewsI cannot make the LIST page work in JSF
I have the following code I am developing with JAVA JSF, primefaces, postgre, cdi, Tomcat: BUSCARBEAN package controller; import java.io.Serializable; import java.util.ArrayList; import…
-
0
votes1
answer139
viewsSimultaneous insertion of items and sales with C#, Windows Forms and Postgresql
Hello, I am developing a sales screen in C# Windows Forms. I’m just at the beginning of the project, but I came across a situation where I’m not sure what to do. I am using a Postgresql database, I…
-
0
votes1
answer50
viewsSQL Join multiple tables only the 1st result
I have 3 tables: **clientes** cli_cliente nome 50 A 52 B **telefones_cliente** cli_cliente tel_telefone 50 387 50 386 50 385 52 400 **telefones** tel_telefone tel_contato 385 RODOLFO - COMPRAS 386…
-
0
votes1
answer52
viewsaverage population per city of each state
Good afternoon, here I am stuck in more question of a job, need to make a query where it returns the average population per city of each state, I managed to perform some researches but all gave…
-
0
votes3
answers50
viewsSintax error at or near "Select"
I am trying to display the contents of the Postgressql database with the employee call table, using the Botton and Bdgrid components of Delphi to display, I entered the commands like this:…
-
0
votes2
answers72
viewsSelect all months of the year in postgres
Salve galera, I have the following select: select sum(valor) valor, extract (month from datahorainicio) from agendamento where extract (year from datahorainicio)= 2020 and status='CONCLUIDO' and…
postgresqlasked 4 years, 6 months ago Victor Marcantonio 1 -
0
votes1
answer251
viewsRestore Postgre . BAT
I’m making a .Bat for Backup and one for Restore of a bank in Postegresql, the .Bat Backup works perfectly, however, Restore gives problem by database owning data. Would have some way to start the…
-
0
votes1
answer233
viewsSpringboot with Hibernate and relationship between postgres tables in different schemas
I have the following problem: I created a database called Test and inside there are two schemas: schema1 and schema2. Within each schema has a table: schema1 -> Tabela1 schema2 -> table2 It…
-
0
votes2
answers222
viewsSave Date.now() to postgres
Hello, I would like to know what kind of data I use in the time column of my table, which will store the Date.now() from Javascript, it returns an integer like this 1591181717431. I thought to use…
-
0
votes1
answer144
viewsConsume REST API from a PL (Postgresql 11)
Hello, I am working on a project in which I must build a PL that should consume a REST service (return in JSON). Looking at the Postgresql documentation, I did not find equivalent functions to…
-
0
votes1
answer63
viewsHow to return a data even if the table has no data
I wonder if there is any way to return a value even if the result of the query is null, for example in the query below I try to return the id 0 case to table1 be it null. I tried to use CROSS JOIN…
-
0
votes0
answers47
viewspostgresql query between
Table X has the following information: (id serial unique, vlinicial numeric(10,2), vlfinal numeri(10,2)) ID VLINICIAL VLFINAL -------------------- 1 0.01 10000.00 2 10000.01 20000.00 3 20000.01…
postgresqlasked 6 years, 4 months ago Groot 146 -
0
votes1
answer69
viewsPurpose of a foreign key name
I am creating tables for a system I am developing and when entering the part of adding foreign key through the interface of PostgreSQL 9.3.17 I noticed you have the field nome to identify this key,…
-
0
votes1
answer24
viewsRe-use method
I made a query to search a user. It worked! But I tried to make another appointment, he gave this message Error: Cannot use a pool after calling end on the pool 'Cause every time I make a…
-
0
votes0
answers78
viewsCreate a. bat file to delete information from a given table in postgresql
I am trying to perform a delete in postgre via bat file, I need it to be so due to a particularity of the system I am adjusting. However, I run the file and it doesn’t delete, I tried including a…
-
0
votes0
answers83
viewsPostgresql, csv file import
I am having a lot of difficulty trying to import the CSV file using PostgreSQL, apparently the program is not able to read the file, but granted permission in all users and folders of the operating…
postgresql postgresql-administration postgresql-10 postgresql-11asked 4 years, 4 months ago Lucaa 5 -
0
votes0
answers22
viewsWhat are the positive and negative effects for command timeout 0 on string postgres connectivion?
Hello, I was constantly getting this mistake Response/Exception: An exception has been raised that is likely due to a transient failure. - System.TimeoutException: The operation has timed out. Then…
c# postgresql asp.net-core .net-core entity-framework-coreasked 4 years, 3 months ago Iago Soares 1 -
0
votes1
answer197
viewsCompare SQL result using PHP
I started a Session and performed an SQL search <? session_start(); $_SESSION['modulo'] = "WebSocialSocial/"; $_SESSION['root'] = substr(__FILE__, 0, strpos(__FILE__, substr($_SESSION["modulo"],…
-
0
votes0
answers29
viewsHow could I possibly catch the first day of the previous month?
First of all good personal day, I am making a base where I would like that from the current month, the user would be able to see the information from 3 months ago, but I’m having difficulty in…
postgresqlasked 4 years, 3 months ago joaovictor-bs 21 -
0
votes1
answer70
viewsDjango + Postgresql Object has no attribute
I am trying to do a validation before submitting my form, but returns me the following error: 'Studentform' Object has no attribute 'termAccepted' models.py of the app: from django.db import models…
-
0
votes2
answers408
viewsDjango + Python update and do not insert
I am using a filter to return some student and update their data, but when I try to save I get the following error: Student with this CPF already exists. and Student with this RA already exists. My…
-
0
votes2
answers155
viewsRemove 1 day from a specific date
Good morning, everyone! I would like a help regarding the database, where I pick a date and after I pick up this date I need to remove 1 day from it, thus pulling the result from 1 day prior to the…
-
0
votes1
answer60
viewsInsert based on a select, with NOT EXISTS validation with multiple records with Postgresql
Could someone help me, as a select-based Insert would do so by checking if the value already exists , with multiple values ? this way this working, however I would like to insert more than 1 record…
-
0
votes0
answers27
viewsHow to insert data into a specialized table?
I have two tables, according to the following logical design: Person(CPF, RG, Name, Address, City, State, Birth date) Client(CPF, Telephone) CPF references Person There are other specializations of…
-
0
votes0
answers40
viewsI can’t compare an arithmetic mean, so I can use select
I’m using postgresql to do the select of an attribute called val_unit of a name table produto. I use having avg(val_unit) > val_unit or where avg(val_unit) to select only the val_unit that stays…
-
0
votes1
answer26
viewsHow to make a remote backup of Postgresql by saving the file on my machine?
I have a machine that I need to backup the Postgresql database, it is in a Docker container on a server, to backup tried the following script: docker exec -t postgresDB pg_dump -U usuario_banco -h…
-
0
votes0
answers28
viewsHow to get a word from a certain letter inside a String in Postgres
I’m trying to get a word from a certain letter inside a String in Postgres. I’ve tried several ways, but I haven’t succeeded using substring, strpos… In the select below, I need to pick up the words…
-
0
votes0
answers25
viewsSum of accounts received by date column
I am unable to add values from the second column per date. The query returns repeated dates. select dtlancamento, sum(vrlancamento) as Total_contas_recebidas from cashier Inner Join person on…
postgresqlasked 3 years, 10 months ago Renato Souza Figueira 3 -
0
votes1
answer36
viewsHow to deal with duplicity exceptions in Constraint Unique?
Speak devs, all right? How best to deal with duplicity errors when trying to create field with Constraint Unique? Just let the exception happen? Or I a findByAlgumCampo and if it already exists I do…
-
0
votes1
answer227
viewsMap dynamically generated tables in Django by another application
I will develop an application with Django in which it will be necessary to query data in a database that is powered by an ERP (desktop). This ERP generates some drive tables by adding at the end of…
-
0
votes1
answer78
viewsColumn ambiguous
I have a problem with the code that I can’t understand. The postgres always points to the error _"column Reference "pro_codigo" is ambiguous"_, but I gave the proper "nicknames" to column…
-
0
votes0
answers32
viewsI am trying to copy the column fields from one table to another already created work, however, I am getting this error
UPDATE variaveis_copy SET descricao = ( SELECT descricao FROM variaveis WHERE variaveis.variavel = variaveis_copy.variavel ) (ERROR: more than one Row returned by a subquery used as an Expression)…
-
0
votes2
answers33
viewsDoubt in the insertion of data performing the relationship in another table
I am trying to enter an Address in the address table and refer to a User already registered without Address in the user table, through the _id that is generated when I enter an Address. I return…
-
0
votes1
answer32
viewsSerial ID not assigning to model id
I’m making a website that receives for a Webservice, data from a dvd (from a site of another colleague), and creates an offer with his information. I think I’m having trouble with the MVC…
-
0
votes1
answer19
viewsHow to update the fields of a table based on other records of the same table - Postgre
I have a table called SERTAB and I need to update all the "value" fields of all Branch 2 records based on branch 1 records, that is, the two branches have the same amount of records or not, but if…
-
0
votes0
answers35
viewsCREATE TABLE with derived column Postgressql
Greetings to everyone, I am learning SQL recently and I found myself with this problem inside a database that brought from the internet to do some exercises, but I’m encountering an expression error…
-
0
votes1
answer140
viewsdelete record in dynamic table with php ajax
I have the following dynamic table and I want to delete the records via AJAX/PHP but I am not able. I tried this way, passing the line id as the button id but it didn’t work...…