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
-
1
votes1
answer82
viewsBinding with PHP and Postgresql
Good people, I’m having a problem making an insert in the postgresql database, this is my insert: INSERT INTO dynfipemarca (codigomarca,marca,tipo, OID, fgenabled, fgsystem , nrversion) VALUES…
-
1
votes2
answers343
viewsHow do I get the latest date by following a SQL filter?
I need to create a filter by following the following rule: GSM which is repeated, and which MOTIVO_ENVIO equal, and STATUS = 'ANOMALIA TEMPORÁRIA' import only the line that contains DATA_ALTERACAO…
-
1
votes0
answers76
viewsshow image coming from postgresql database with ajax
I saved the image in the postgresql(oid) database with php. Now I intend to show this image on the screen through AJAX, but I’m not getting it. The line "$("#image") is maintained.…
-
1
votes0
answers89
viewsrake:db setup error (failed to connect to postgresql) in the Ubuntu subsystem for Windows
Hello! I am using the Ubuntu subsystem (18.04) in windows com ruby on Rails (ruby version 2.5.1 and Rails 5.2.2) and with Postgresql in version 10. I surrounded a rake db:setup at the root of my…
-
1
votes2
answers658
viewsHow to insert an array in a column of the Postgres array type with Laravel/Eloquent?
I have a column like Postgres array and I’m trying to insert an array into it with Eloquent, only it’s giving me a wrong saying that the column is badly formed. My model is like this: class Leituras…
-
1
votes1
answer76
viewsResult of a SELECT in Postgresql is not the same in Sqlite
Good evening guys, I developed a Query in Postgresql to apply a SELECT in my data imposing some rules, and these rules are very important for me to get the right result at the end of the selection.…
-
1
votes1
answer578
viewsInsert or update Posgresql via Python
Today I am using the following code to call via API and store my data in the Postgresql database: conn = psycopg2.connect("dbname='DBNAME' user='USER' host='HOST' password='PASSWORD'") insert =…
-
1
votes2
answers85
viewsJPA Hibernate with Postgres - 2 transactions
I started using Hibernate 1 month ago. I am developing a simple application from bank to college. I have an account class, which has the Withdraw Value method : public boolean SacarValor(long…
-
1
votes1
answer47
viewsFalling in catch while trying to establish a connection
I’m using Netbeans and can’t establish a connection. I added . postgre jar (postgresql-42.2.5.jar) in the lib folder and tested the connection in the Netbeans tab (Service > database), ok worked.…
-
1
votes1
answer222
viewsMerge JSON Postgresql column data when performing UPDATE
The scenario is as follows, I have a JSONB type column in my database where a JSON structure is saved. What I need is that when this structure is updated, it will update only the keys that have been…
-
1
votes1
answer301
viewsCreating a String in Postgresql
So, I have this sequence in a column of a table where every time I do an insertion its value is defined by nextval ('ptable_pr_codigo_seq' :: regclass) CREATE SEQUENCE public.ptable_pr_codigo_seq…
-
1
votes1
answer274
viewsError inserting data with Spring
I am entering data that the user type in the console, I take these values with the class Scanner of Java and play in the Postgres database using Spring Boot. The problem is when I will insert a…
-
1
votes1
answer118
viewsDoubt with the Function window in Postgresql
I have a job for college and I have a question in an exercise that I have to use the window functions to make the correct query. This is my query: SELECT pais, modelo, fabricante.nome, (venda.valor…
-
1
votes1
answer31
viewsPsql -c is lowering my table name
Hello, I am executing the following command: psql -d copia-local -U postgres -c "COPY "Questions" FROM '/home/pedro/Documents/PostGre/data/cooked/Questions_cooked.txt' WITH DELIMITER '|' NULL AS ''"…
-
1
votes1
answer47
viewsSQL query does not return expected items
I have two tables called Protocol and Analyze with a 1:n relationship, a Protocol may have several Analysis, Protocol has a composite primary key. I need to write an SQL that returns the Protocols…
-
1
votes1
answer142
viewsPsqlexception: ERROR: target lists can have a maximum of 1664 entries
I am trying to persist an object in the database but I get this error: WARN: SQL Error: 0, SQLState: 54000 ERROR: ERRO: listas de alvos podem ter no máximo 1664 entradas Advertência: A system…
-
1
votes0
answers33
viewsUpdate does not commit bank changes
Good night, you guys! I’m new to ASP NET MVC and I’m making a CRUD simple with bench Postgresql. I’ve already implemented the Insert, delete and Get, but the Update is not saving the changes in the…
-
1
votes1
answer39
viewsReport with date_trunc including zeroed values
I’m doing a consultation in postgres, but it only brings the results where the inspection body is not reset, I needed this query to bring all the results from 8 to 18, including zeroes: AS YOU…
-
1
votes1
answer161
viewsColumn splitting error with SQL Subquery
I am using postgresql I have a query that when I run a division between the columns (soma_neighborhood / Soma_city) it always returns 1, should return the value described in the field and not the…
-
1
votes1
answer80
viewsCalculate total of identical Ids
I’m working with the postgresql , running the following query : SELECT "tcfac"."co_cds_ficha_ativ_col", to_char(dt_ativ_col, 'DD/MM/YYYY') AS "data_atividade", to_char(hr_inicio, 'HH24:MI') AS…
-
1
votes1
answer109
viewsCreation of Trigger that saves information on file
I need to save in a TXT file all the closing codes made in a Postgresql database. The table closures has the following fields: codigo | data | nome -------|------------|--------- 1 | 2019-08-01 |…
-
1
votes0
answers208
viewsCount number of occurrences in Postgresql
I have a database where the values are organized more or less as follows: id | produto | data com registro de venda ---------------------------------------------- 1 | Prod1 | 17/09/2019 2 | Prod1 |…
-
1
votes1
answer2432
viewsSQL - SELECT DISTINCT in only one field
So, I’m doing a search in which returns the non-repeating geometries (which has as layer name Access and Middle): SELECT DISTINCT geo_geometria FROM geral_elemento_cartografico WHERE ds_camada LIKE…
-
1
votes2
answers145
viewsSELECT RANGE 1 IN 1 HOUR - POSTGRESQL
GOAL I’d like to make a SELECT within a range of 1 hour in 1 hour DATA TABLE CREATE TABLE t ( t_id INT PRIMARY KEY, time TIMESTAMP ); INSERT INTO t VALUES (1, '2019-10-28 08:00:00'); INSERT INTO t…
-
1
votes3
answers99
viewsSum of groups in an SQL
I need to do the TOTAL sum per office of a field of hours that is in decimal format, in addition, perform the conversion of it. I can do the sum of the employees, but I can’t add up to "groups" of…
-
1
votes1
answer1279
viewsPG::Datetimefieldoverflow: ERROR: date/time field value out of range: "22/11/2019 19:47:22.793483"
I’m developing an application on Ror and moving it up to Heroku. When I use the command heroku run rake db:migrate I get that mistake: $ heroku run rake db:migrate Running rake db:migrate on ⬢…
-
1
votes0
answers20
viewsPostgresql: Intersection between polygons returns lines and points
I am working on a spatial query and have two tables with features of Geometrytype ONLY Polygon or Multipolygon: ZONING TABLE: select ST_GeometryType (geom), count (*) from…
postgresqlasked 4 years, 11 months ago Clara Magalhaes 25 -
1
votes1
answer648
viewsAssociations with Node.JS / Sequelize
Good evening dear friends, I’m developing an API with Node.JS / Express / Sequelize and I need some help. As it is the first time that I use relational databases with Node, I don’t know exactly how…
-
1
votes2
answers354
views(Query SQL) Limit the number of rows in a select with Inner Join and Where in
I have 3 tables, products, Category, product_categories, this last one was created pq the product and category relation is n to n. I have a select that returns me all products of all categories, but…
-
1
votes0
answers81
viewsLoop with a pool.query pg(postgres) in the Ode, is giving conflict in the delivery of the Sponses
I’m a beginner in Node programming, I hope someone can help me, The problem is this, I am making an app with Node in which you have a for loop with the request body (req.body) and at each iteration…
-
1
votes1
answer104
viewsSQL and R - Download data from a table with space in names and integer filter
I have a database in Postgresql and would like to download a table, but with some filters. The column 'CNAE 2.0 Class' is an integer. library(RPostgreSQL) PIA_Estab <- dbGetQuery(con," SELECT *…
-
1
votes0
answers75
viewsPostgresql connection to Django
Good afternoon, I’m having a problem connecting Django with Postgresql I installed psycopg2 on Jango, changed the connection in Settings.py to connect with postgre and when I give the runserver it…
-
1
votes1
answer35
viewsR and Postgresql - AND/OR and BEETWEN/NOT BEETWEN how to help logic?
I need to get some information from the postgresql database through R . However, the filters are not downloading what I want. I would like to download only the cnaes of companies with cadastral…
-
1
votes0
answers108
viewsPerform two actions on the same Trigger in Postgres
I’m having trouble with Trigger where: The table itens_compra_fornecedor through the column valor_compra calculates the resale price of the column valor_revendaon the table produto that has no…
-
1
votes0
answers15
viewsConversion of Resource (stream) in php bringing unexpected results
Environments Local AS: Linux Mint 19.3; Bench: Postgresql 12.2 (Ubuntu 12.2-2.pgdg18.04+1); PHP: 7.3.17-1+ubuntu18.04.1+deb.sury.org+1. Amazon AS: Amazon Linux 2018 V1 - Beanstalk V2.9.3; Bank…
-
1
votes1
answer21
viewsHibernate Table replication with Quence
Good Afternoon, In an application I am working on we have a table called tb_perfilparametrovalorpdv, following the mapping @Data @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @Entity…
-
1
votes1
answer229
viewsSELECT with two Foreign key, return the two tables even looking for only one of the keys
I have a table that has two FK to reference the same table. By selecting all elements that have one of the two FK, using the query: SELECT "Proposta".id, "Proposta".id_segurado,…
-
1
votes0
answers46
viewsCreating a dummy column based on the value of other columns
I have a table with 200 columns. This table has columns that identify the individual (id) and year (year). I need to check if the id sent information that year. If 0, did not send. If 1, sent. For…
postgresqlasked 4 years, 5 months ago RxT 995 -
1
votes0
answers79
viewsLogs in postgresql
Good morning Everybody, I have a trigger to log in INSERT, UPDATE and DELETE in the postgresql, but the way I’m logging in, it’s as if the bank’s own user had done the operation. I needed to be…
postgresqlasked 4 years, 4 months ago Colasanto 468 -
1
votes0
answers16
viewsHow to search a sentence literally in postgre
Fellas, I need some help. I’m trying to research a literal phrase in the postgre. I used plainto_tsquery, but he searches the words in the text and not the literal phrase as it was typed. Which…
-
1
votes0
answers19
viewsPerform query - relation Many to Many - Sequelize
I have a problem to perform a query using the Sequelize ORM. The structure is as follows: Migrations/tables: Developers, Technologists, developers_dechnologies. The relationship between developers…
-
1
votes0
answers62
viewsRepository.findAndCount in related table column in typeorm/graphql
I am using typeorm and graphql in my api and want to make a findAndCount in a table called corresponding_users that has a one to one relation with the table users, but the query only works if Where…
-
1
votes1
answer582
viewsMigration does not create table in database. Typeorm, postgresql
Good evening, you guys. In this project I am using typeorm to configure my database. I create my Migration, but when I execute the command Yarn typeorm Migration:run, It doesn’t create the table I…
-
1
votes1
answer52
viewsHow to get around the use of reserved database words with Hibernate?
I am learning to work with REST API in Java using spring with Hibernate and I have the following problem. My entity has the name user which is a reserved word in the database I’m using(postgres), so…
-
1
votes0
answers35
viewsUsing Netbeans to Access BD Posgresql - jdbc. Drivers
I made the connection in the database using netbeans but is not finding the DRIVE, apparently everything is correct, but always returns the error: No suitable driver found for…
-
1
votes0
answers46
viewsDoubt Beginner WHERE EXISTS
I’m a beginner in the SQL world, I’m learning some functions and I came across a problem where I can’t understand. I have a table medico with the attribute cod_medico. In that attribute is the…
-
1
votes2
answers82
viewsGroup closer values in Postgresql
Good morning, you guys. I have a question regarding a grouping of data in postgresql and I would like to know if you can help me. I have a database containing a table with entry times in an…
-
1
votes1
answer35
viewsFilter search for only ID’s that have more than one POSTGRESQL linked record
In the query below I can find the largest reduced linked to account, but I need it to be only in the id’s that have more than one reduced linked. The table has more than 4000 reduced SELECT (id,…
-
1
votes0
answers45
viewsPerform automatic backup using Docker
My application is composed of Frontend (Vue.js) + Backend (Node.js with postgresql bank), before playing in production I dockerizei using Docker and Docker-Compose. The file below is…
-
1
votes2
answers74
viewsDúvida Postgresql
Good morning. I have the following SQL working: Select g.galeria,g.tipo,g.finalidade,count(p.galeria) as total from pessoas p full join galerias g on p.galeria = g.galeria group by…