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
answers208
viewsExecute a Postgres command via ssh and bring the result to various or txt
Friends, I have the difficulty of creating a script to perform an UPDATE in a database connecting via ssh being outside the server follows below my code. Commando: ssh hostname 'psql -d database -U…
-
0
votes1
answer48
viewsDifficulty running a Select in Postgresql
I am having a difficulty in making a select in postgresql, in the select in question, I would like to display the name of distinct cities related to two distinct tables, below follows the DER and…
-
0
votes1
answer123
viewsPOSTGRES: INNER JOIN 1:N with multiple tables. Need to count and display records that were accessed as a list
I need to count table records acesso_registro and show in a list. Schema: acesso_registro +--------------+--------+------------+ |id_tipo_midia |id_midia| data_acesso|…
-
0
votes2
answers493
viewsCount number of rows of different tables doing LEFT JOIN using the Count() function
I need to count the number of tables records cliques and curtidas and show these numbers to the media type Video table tipo_midia and the specific media, that is, the video that the person liked or…
-
0
votes2
answers118
viewsBasic SQL (Join and Where)
Good night, I’m trying to solve a problem which is this:: Tables: editoras (cod int primary key, nome varchar (50)); autores (cod int primary key, nome varchar (50)); livros (isbn char (13), titulo…
-
0
votes1
answer83
viewsHow to Insert in Postgresql based on data from a Dataframe
I am trying to make an Index of the data I have in a Dataframe (regastei via API GET) for a table I created in Postgresql. I searched a lot but I could not get a return. Someone can help me?…
-
0
votes0
answers190
viewsInsert data into Postgresql using Dataframe Pandas
Prazados, I am working on a particular project in which I want to do an ETL with Python and Postgresql. I intended to consume a GET API using request, persist this data in a Dataframe and after…
-
0
votes0
answers1760
viewsPostgres using variables in SELECT
In Mysql we can do: SET @pedido = 123; Afterward: SELECT @pedido We have something like that in postgres? I have looked on the web, but only found in the construction of functions and procedures The…
-
0
votes0
answers179
viewsPostgresql when creating tables and columns. OBS: Version 11.5, last version of Postgresql
Galera is the following, when I will create the tables and columns in postgresql using pgAdmin4, when I create the tables , they save her name and the field name between "". example: As you see in…
-
0
votes0
answers51
viewsShare a table for two different databases in version 9.4
Good afternoon , we are trying to make a trigger in the laboratory of our system , We are currently trying to make even distinct bases share the product table , ai would work like this every change…
postgresqlasked 5 years, 3 months ago Victor Hugo 1 -
0
votes1
answer76
viewsPostgres - lo_import - import user’s machine directory image
I have an application that stores the photo of a product - it is in a table separates from the main table CREATE TABLE produtos_imagem ( registro integer NOT NULL, imagem oid, CONSTRAINT…
-
0
votes2
answers1039
viewsTable in Postgrethe ID field is not auto incremented
I’ll explain my problem: In my SQL system already came the error in INSERT, stating that the id field, which is autoincrement is stating that it is null: INSERT INTO cliente_sub_grupo…
-
0
votes1
answer207
viewsHow to Update in Two Table?
I’m looking to make a update in two tables, postgres. I’ve seen some posts using other banks and I believe I’m doing the same, maybe some particularity of the bank or is missing something. Update in…
-
0
votes1
answer170
viewsHow to do an automatic UPDATE after an INSERT in tables without FK in Postgresql
The database simulates a traffic department (similar to the DMV). I would like to implement a resource in which: once a new one has been registered multa, the system would automatically add the…
postgresqlasked 5 years, 2 months ago Lucas Santana 3 -
0
votes1
answer1605
viewsERROR: more than one Row returned by a subquery used as an Expression
GOAL I have two tables (tb_get_gap, tb_getCountSRVS), where in the first table count to get the desired values and in the second I have integer values, I just want to take the values of the two and…
-
0
votes1
answer62
viewsreturn specific content with regex - POSTGRESQL
I have the query below, where are captured the 3 largest memory consuming processes on the machine. I would like my select to display only the pid and the name of the process contained in {name: }…
-
0
votes2
answers104
viewsConvert a Query with a Subquery to a Query with a Join
I’m trying to optimize a Query that the system I’m working on makes it have a SubQuery inside, only this SubQuery is referencing another table that has relation to the main table and by what I’ve…
-
0
votes0
answers754
viewsSequelize Timezone postgresql
I’m performing a sequel, but when I return the information that was recorded, returns with 3 hours above the postgres. json Insomnia: Given in postgres: I tried to change Timezone in sequelize, but…
-
0
votes0
answers38
viewsReturn of a wrong create Function
I have the following table in the schema utfpr: create table Matricula( dis_sigla varchar(50), tur_numero varchar(15), alu_ra varchar(100) , mat_ano date, mat_nota float not null, constraint…
-
0
votes1
answer68
viewsHibernate Query using Like and Where
Beauty guys ? So I’m doing a query with Hibernate, which is the following: Query query = session.createQuery("SELECT c FROM Cliente c WHERE c.filial =:filial AND c.ativo =:ativo AND c.tipoCliente…
-
0
votes2
answers607
viewsError add-Migration . net core 3
I am trying to add the add-Migration in my solution but always happens the following error "Value cannot be null (Parameter 'connectionString')" but my connection string is correct in…
asp.net-mvc postgresql asp.net-core asp.net-web-api asp.net-core-web-apiasked 5 years, 1 month ago Diego Wenndson Souza 3 -
0
votes1
answer40
viewsInsert using time table only at values that do not exist in the main table
I am trying to make an Insert in a table using another temporary table, but the Insert can only occur if the item does not exist in the original table. create temp table tmp_x as select * from…
postgresqlasked 5 years, 1 month ago Gustavo Cruz 17 -
0
votes1
answer900
viewsHow do I use order by in two columns in the same table? Postgresql
Hello, I have a problem and would like your help. I am beginner with database and need to make a report. The report is of all budgets organized by city and by date. Wanted more or less like this:…
-
0
votes0
answers1410
viewsError inserting in table: "Missing FROM-clause entry for table..."
I have three tables: CREATE TABLE Bebidas( id SERIAL primary key, nome varchar(40) NOT NULL, preco_bebidas decimal(5,2) check (preco_bebidas > 0.00), qntd int); CREATE TABLE Shots( id SERIAL…
-
0
votes1
answer190
viewsPostgres/Mysql Changing the data of a repeating field
Good morning I have the "areas" table, In it I have the column "f_name" I want to transform the "f_name" column to Unique id. However, there are repeated data currently. I need an Sql command where…
-
0
votes1
answer125
viewsIs there any way to select a comparison of duplicate records?
I have a table with 57 fields, due to an oversight in the past did not create the REQUEST field as Unique Key Due to the use by more than one user on a screen of the system he ended up allowing the…
-
0
votes2
answers160
viewsHow to delete duplicate lines in Postgres database?
In my bank I have a table that has a list of (carrier and waste specifications) where the carriers can have several waste, I checked that the data are duplicated and are represented in this way:…
-
0
votes0
answers127
viewsCharacter 'º' is accepted by utf8 within the Insert, but not when I use COPY
I’m trying to migrate data from a Firebird database to a Postgresql version 12.0. To generate a. csv file containing the table records in Firebird, I use the software Fbexport, ./fbexport -Sc -D…
-
0
votes1
answer102
viewsIs there a performance gain in concatenating strings directly into SQL?
Actually, I have a code kind of like this: const users = await query(` SELECT "id", "username", "email" FROM "users"; `) .then((users) => users.map((user) => { user.id =…
-
0
votes1
answer88
viewsNullpointerexception when inserting java data
Hi, I’ve researched several forums, youtube and google outside... I need a lot of help because I have little experience but I really want to learn, in many things I can do but when it’s for dates…
-
0
votes1
answer51
viewsHow to instantiate a constructor variable (to be Primary key) within the table?
The question is misspelled, but the problem is this. I’m working with BDOR in the Postgresql. I created two Types and I’m adding them to Type animal. Soon after, I used Inheritance and created the…
-
0
votes1
answer72
viewsDoubt when using a Query answer in Nodejs
Well, first, I have two files: index.js that handles the requests and another that selects in the database, but I don’t know how to return it to the client. app.get('/pesqAlimentos', (req, res)…
-
0
votes1
answer370
viewsWhen to close a postgres pool at Nodejs?
I’m with a Nodejs application that basically has a food search engine. However always in the second research occurs the following exception and I do not know in what part of the code exactly I…
-
0
votes1
answer98
viewsSQL Error no Postgres
My select: SELECT * ( SELECT v.placa FROM gr_veiculo v WHERE v.id = ( SELECT DISTINCT r.cavalo FROM lg_relacao_veiculo r WHERE ( r.cavalo = (SELECT mv.gr_veiculo_id FROM…
-
0
votes3
answers100
viewsError doing an INSERT in Postgresql database
When making an insertion in the Postgree bank I have as a response a very strange error: 2019-11-22 17:06:30.310 ERROR 15212 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : Nenhum…
-
0
votes1
answer130
viewsHow to do a Query ignoring the side spaces of the Column content?
Good morning, everyone! Using the Query: @Repository public interface SessaoRepository extends AbstractRepository<Sessao, Long> { @Query(value = "SELECT p FROM Sessao p WHERE p.dc_secao…
-
0
votes2
answers53
viewsAggregation error only in postgresql 9.4
I am having the following error when using the postgresql database in production (version 9.46), in development the error does not appear (9.6). PG::Groupingerror: ERROR: column "sectors.name"…
-
0
votes0
answers33
viewsHow to search for array in postgres through sqlalchemy?
My database has a column like ARRAY(sa.BIGINT). My intention is to use the command filter_byof sqlalchemy to search for an element that has the list_secao_id field equal to [58,45,12], for example:…
-
0
votes1
answer521
viewsPostgresql error with Spring boot - api
Personal opa I’m making a very simple application, to see how postgresql works. I’m making a Spring Api application. My class @Entity public class Product Implements Serializable { @Id…
-
0
votes3
answers101
viewsReturn value corresponding to date
I have a table with values and dates referring to the cost of a vehicle. However the table is filled in as follows: data_saida | custo_saida ------------------------- 2019-11-17 | 25 2019-11-18 | 20…
-
0
votes1
answer59
viewsProblems with Group By on Postgresql
I’m trying to make a view in a Postgre database: CREATE VIEW anuncio_points AS SELECT a.*, (CASE WHEN p.points is null THEN 0 ELSE sum(p.points) END) + u.points as points FROM anuncios as a LEFT…
-
0
votes1
answer167
viewsMask to turn integer into string - Postgresql
Good morning! I am trying to implement a mask on an integer number, whose output will be a string with embedded characters. I would like the user to enter only 12 integer digits and the database to…
postgresqlasked 4 years, 11 months ago Clara Magalhaes 25 -
0
votes2
answers322
viewsInsert a Count(*) value into a variable in Postgresql
I am migrating from Mysql to Postgresql and trying to create the following Trigger: CREATE OR REPLACE FUNCTION verificaReservaQuarto() RETURNS trigger AS $$ begin declare ocupado int; declare…
-
0
votes0
answers48
viewsAllow external connection to the database
Guys I have a problem accessing a database that is in a Virtual Machine. I have a machine A that has an application Laravel all configured and the project installed, and has another machine B where…
-
0
votes0
answers47
viewsRestrict way to insert into SQL tables
Hello, I have a database in which I save some information of the establishment in a table and then the information of the same address, in another table. I wonder if there’s any way I can narrow it…
-
0
votes1
answer41
viewsTypeerror in INSERT via Python in Postgresql
I have the following code import json import io import psycopg2 connection = psycopg2.connect("dados da conexão") connection.autocommit = True cursor = connection.cursor() readTest =…
-
0
votes0
answers256
viewsSQL Error [42601]: ERROR: syntax error on or near ":" Position: 683
I am trying to make a query with CONCAT, Seto the values I wish only that returns syntax error SQL Error [42601]: ERRO: erro de sintaxe em ou próximo a ":" Position: 683 select processador.cd_code,…
-
0
votes1
answer60
viewsTwo WHERE with two independent conditionals
Fala Pessoal, I am mounting a query with the objective of bringing 2 columns that do the same query but with 2 different conditions. ex: SELECT COUNT(MAX(l.created_at))as last_login_x1,…
-
0
votes1
answer200
viewsForeign key breach error only in inclusion via API, via insertion bank is correct
I have a . NET Core API that connects to a Postgres database using Entity Framework. For each table that needs to do some insertion I have the model with the right fields (created by hand because I…
postgresql entity-framework asp.net-core sql-insert foreign-keyasked 4 years, 10 months ago Ianagos 71 -
0
votes1
answer182
views'System.Data.Sqlclient.Sqlconnection' does not contain a Definition for 'Query'
I wrote a C# method to make a "switch" between different database types in my application. Where the problem is that each database type makes use of a different library (SQL => Sqlconnection and…