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
votes1
answer340
viewsRestore Postgresql Database in C#
I created a . bat to restore a database in Postgresql and it worked perfectly using the following command: set PGPASSWORD=postgres123 C:\Progra~1\PostgreSQL\9.4\bin\pg_restore.exe -i -h localhost -p…
postgresqlasked 7 years ago Bruno Silva 400 -
0
votes1
answer8478
viewsSelect most recent record from a given table - Postgresql
I need to select the most recent record of my Estoque case the column data be different, I managed as follows to bring the oldest when the dates are different: SELECT codigosuprimento, numeroserie,…
-
0
votes1
answer425
viewsHow to set the time of a "timestamp" to 23:59:59 in postgresql?
I have in a cell that contains only the date, in case 2018-07-11, I need to make a select that will bring this cell so: 2018-07-11 23:59:59, it is possible to do this?…
-
0
votes0
answers66
viewsMaterialized view
I’m having a problem creating a view CREATE MATERIALIZED VIEW table_name You’re making this mistake: ERROR: syntax error at or near "MATERIALIZED" LINE 1: CREATE MATERIALIZED VIEW…
-
0
votes2
answers275
viewsRelationship problem in the Mother Table (Inheritance) in Postgresql
I got the Mother Pay Table: CREATE TABLE pagamento ( pagcod serial not null, CONSTRAINT pk_pag PRIMARY KEY (pagcod) ) And the two daughter tables Cash and Credit Card: CREATE TABLE dinheiro (…
-
0
votes0
answers67
viewsPostgresql compare time between two hours, and if it exceeds the hours of the day, limit up to 23:59
I’m making a query sql in the ruby-on-rails for PostgreSQL where I check if the user input is between hora_entrada and hora_entrada + (hora_entrada + limite_banco_horas) and the same goes for…
-
0
votes1
answer56
viewsPostgres user with access only in the replica
The database in question has replication of data, the same database, however on another server, has to ensure the access of a user ( user_bi ) only in the replica ? REVOKE ALL ON ALL TABLES IN…
-
0
votes0
answers41
viewsCreate database
I’m trying to create a database on postgres but am getting the following message: ERROR: cannot set transaction read-write mode During Recovery I have uninstalled, cleaned the registry, installed…
-
0
votes1
answer687
viewsWorking Flyway with Postgresql Database
Take a look at the repository. Repository of the Algaworks Institution This project is not mine, but my project is identical to this one with a single difference, I am using Postgresql database and…
-
0
votes4
answers268
viewsPostgresql - Foreign Keys failing
Hello, I have a SELL table and a VENDA_ITEM, the link between them is made via a Foreign Key that cascades and the update cascades. Well, in the VENDA_ITEM table there is a Trigger that runs before…
postgresqlasked 7 years ago Marcos Spirito 75 -
0
votes0
answers110
viewsHow to update several php postgresql records?
I need to update several records at the same time with php/postgresql (also for mysql) through a checkbox and textbox but I’m not getting it. The code below only updates the sequence field of the…
-
0
votes0
answers55
viewsDoubt with Image fields in Postgres
I used the sql below to view the size of all tables of the database, it return me a total of 98 MB, more as the database has images that are recorded as binary and the same are not in a table, I…
-
0
votes1
answer42
viewsPostgresql - Foreign Key after import
I have a database in Firebird and I am passing the data it to Postgresql, so I made an application that reads the data from Firebird and inserts it into Postgresql. The database is from a…
-
0
votes2
answers200
viewsSpatial + Postgis + Geotools Hibernate - Persistence Failure
I have a problem to persist a geometric data in the database (Postgres) I gave a read on the forums and documentation and found nothing about it, someone can give me a help? Libs: pom.xml with…
-
0
votes2
answers784
viewsSelect current date comparison with exact date 1 month ago
I made this select that returns me the amount of records in the last 24 hours select count(*) from registros where registry_date >= NOW() - interval '24 hours' I need a select to compare the…
-
0
votes1
answer262
viewsSQL group by returns duplicated POSTGRESQL
My query SQL is returning multiple Rows with the same id follows: SELECT distinct (c.nome), c.id, c.email,c.telefone1,c.telefone2, SUM(a.valor) AS "valorDaCompra",u.id AS "idLoja",u.nome AS…
-
0
votes2
answers43
viewsselect search in database with repeated records
I’m making a select in my bank, whatever, Postgres, and more records are coming.. For example, id_pessoa comes a 10 more record than should come.. SELECT pac.cns, pac.cns_responsavel,…
-
0
votes1
answer461
viewsPostgres - Permissions within the function
I am setting up a system in which the user will have a very limited access, just view and perform certain specific functions. Scenario (with root user) Has three tables : Person Device Access And…
postgresqlasked 6 years, 11 months ago Guilherme Lautert 15,097 -
0
votes2
answers1597
viewsPostgresql Error: "ERROR: there is no Unique Constraint matching Given Keys for referenced table "address""
created the table Address and Client, as follows sql: CREATE TABLE ENDERECO( Logradouro VARCHAR (50) NOT NULL, CEP VARCHAR(50) NOT NULL, Numero INT NOT NULL, Complemento VARCHAR(50), Cidade VARCHAR…
-
0
votes0
answers33
viewsPostgress Query SQL
Hello. Provide the code and description of the group and the quantity of products associated with each of the groups. Order the result by the quantity of products of each group. I’m having trouble…
postgresqlasked 6 years, 1 month ago Wagner 11 -
0
votes1
answer258
viewsError while removing table in Postgresql
I am trying to install and configure Postgresql on my machine, however I am having some doubts and some problems. I followed the following steps of the installation tutorial on official website. I…
postgresqlasked 6 years, 11 months ago Michael Pacheco 1,657 -
0
votes1
answer72
viewsSelect the value of a field depending on a date
I have a table with the fields DT_FIMCALCULO, VL_DEPREREVVIDAUTILACUMULADA e CD_SEQUENCIALBEM. And for each CD_SEQUENCIALBEM I have several DT_FIMCALCULO each with a VL_DEPREREVVIDAUTILACUMULADA…
-
0
votes1
answer88
viewsA Rigger that checks the deadline for all products in the table
Good afternoon to everyone in the community. I’m trying to make a Rigger that checks the products that have their expiration date and change their status in the table using postgresql
-
0
votes1
answer76
viewsProblem when reloading Table
I have the following problem, at first run my Defaulttablemodel loads normally as can be seen below in red: After registering, changing or deleting once, the table updates normally, but when I…
-
0
votes0
answers39
viewsCommunicate PHP with Postgresql
I’m trying to communicate a program made in php with postgresql bd. I made a connected class, as shown below: <?php class conexao{ var $connect; var $con_string = "host=localhost/TCC port=5432…
-
0
votes1
answer96
viewsGet sales average for a given month
I would like to take the average sales of the month by product description and not by date with day, month and year, but I don’t know how to get. SELECT AVG(vend_qtde) AS qtde_vendas from tb_vendas…
-
0
votes1
answer61
viewswrong projection on the map
I’m trying to insert points into a layer using leaflet and save those points in a Postgres (Postgis) database. With the geoserver I can see the layer but the points appear to me all badly and I know…
-
0
votes2
answers857
viewsPostgresql, Variables for psql functions
I am trying to create a Trigger Function to remove a schema created in the database based on an idproj attribute from the geo.projects table listed below: CREATE TABLE geo.projetos ( idproj serial…
-
0
votes1
answer76
viewsSave text with line breaks in BD
See below for a java code to save an SQL command return in Postgresql. The command is EXPLAIN ANALYZE. The problem is that while saving this in the database, it loses line breaks. Someone would know…
-
0
votes0
answers33
viewsError creating GIN type index
When trying to create an index of type GIN in a table I came across the following error: CREATE INDEX idx_descricao on produtos USING gin (descricao gin_trgm_ops); ERRO: classe de operadores…
-
0
votes1
answer49
viewsPostgresql Database
How do I select with sum and inner join to sum an x value between 3 tables. A query to return as few results as possible. create table credit_card ( credit_card_id int primary key, nome varchar (30)…
-
0
votes4
answers534
viewsHelp with distinct
I have the following sql query: select nome, data, situacao from cadastro The result is like this: MARIA 01/01/2018 0 MARIA 15/01/2018 1 GISELE 15/01/2018 0 CICERA 08/01/2018 1 ANTONIA 20/01/2018 0…
-
0
votes1
answer50
viewsPick up the start day and the end day of the specified week
Good afternoon, I’m returning from the database the number of the week in the year. ["data_hora"]=> string(16) "19/11/2018 15:26" ["num_semana"]=> string(2) "47" Where num_week is the number…
-
0
votes1
answer49
viewsPostgresql - use custom select return in loop
I have a function that makes a select like that: SELECT a.nome, b.email into nome, email FROM tabela1 a INNER JOIN tabela2 b ON b.fk = a.fk Is there any way to create a "temporary table" that I can…
-
0
votes1
answer350
viewsPostgresql connection with JDBC in eclipse
Appears on the console: java.sql.SQLException: No suitable driver found for jdbc:AulaFBD://localhost:5432/TrabalhoFBD at java.sql.DriverManager.getConnection(DriverManager.java:689) at…
-
0
votes2
answers55
viewsSelect with wrong result
I have the following select: SELECT suprimento, public.tiposuprimento.descricao, capacidade, count(public.estoque.codigosuprimento) quantidade,estoqueminimo, sum (valorunitario) valor FROM…
postgresqlasked 6 years, 9 months ago R.Santos 2,251 -
0
votes1
answer302
viewsHow to escape quotes from a json key in Postgresql?
I have a function that receives JSON’s, it turns out that it is possible for the user to put as follows: Normal: '[{"nome":"João Carlos"}, {"nome":"Maria Silva"}]' Problem: '[{"nome":"João -…
-
0
votes0
answers51
viewsPagination query with LIKE function
good afternoon. I have an error in paging query when I pass a search parameter. Here’s the problem: When I’m on page 2 and I do a search for an item on page 20 of mine sql returns nothing. Follows…
-
0
votes1
answer466
viewsDjango: Local Postgresql and Heroku?
I would like to use Postgresql locally and on Heroku. How I set up mine settings.py to know which configuration to use? I’ve tried putting it as an environment variable, but I haven’t been able to.…
-
0
votes0
answers28
viewsResultset to return BD data - Java
All right, let’s go... I have a question, I have a Bd with 3 tables and used Inner Join to unite them, and internal function of Postgresql to create a dynamic table, whose result is this: I need to…
-
0
votes1
answer62
viewsNullpointer Exception when entering data into a Foreign key
I am facing some problems with entering data in my clients table. Specifically with foreign keys fk_telefone_fisico and fk_telefone_juridico. When I register the user ee gives me a…
-
0
votes0
answers81
viewsIntegration between two databases
I have an idea to integrate two databases, at one point I have the database Postgressql with system A and on the other side a bank Firebird in system B. For example: I recorded a client on system A…
-
0
votes1
answer60
viewsHow to access a DB in an AWS EC2 port, using Datagrip or Pgadmin locally
I have an instance on AWS EC2 that has a Database on Postgres (not on Amazon RDS). I would like to access it using some tool like Datagrip or Pgadmin on my local computer. Is it possible? How to do?…
-
0
votes1
answer568
viewsPsqlexception: No results returned by query
I cannot identify the error that is returning when trying to insert data to the BD. I believe the error is in the insert function. The error returned is: Exception in thread "main"…
-
0
votes1
answer150
viewsWhich Postgres SCRIPT to list all Schemas?
Do I need to know which script I use to list all the Schemas of a Database ? 1 Condition is to list all Schemas I created and do not need Postgres Schemas I need this information to be able to…
-
0
votes0
answers33
viewsError when consulting the Database from the pgAdmin4 program;
Good afternoon, I’m having similar problems when I’m trying to research the comic. Digito: SELECT * FROM profission(cod_prof,nome_prof,sexo_prof,cref_prof,titulo_prof) VALUES…
postgresqlasked 5 years, 10 months ago Fernando 1 -
0
votes1
answer341
viewsSet timestamp field to accept value 0000-00-00 00:00:00
I’m in the wrong postgres, because a field that is timestamp this receiving value '0000-00-00 00:00:00', can tell me how to set up a field timestamp accept date and time reset ? Follows error:…
-
0
votes1
answer92
viewsClass diagram x Database
I have a class diagram and would like to know how to build the database. Follow the scenario: With the classes below I have a Demand that has a requester and an analyst, right next to each of the…
-
0
votes1
answer57
viewsUpdate method does not update in the database
With a problem when editing, when I click on the button it looks for the information of the fields in the console.log, already has the ID on the route also the problem is that it does not update the…
-
0
votes1
answer407
viewsSet a condition in order by mysql
I am having doubts about a subject related to order by. In my table you have the following information: ID | ORDEM | NOME 1 | 0 | NOME01 2 | 2 | NOME02 3 | 1 | NOME03 I want to give a select where…