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
votes2
answers522
viewsCurrent value of an "auto increment" field in Postgresql
I would like to know, what are the ways of obtaining the current position of the value "auto increment" of columns of a table in the Postgresql.
postgresqlasked 4 years, 11 months ago rbz 9,949 -
1
votes2
answers671
viewsSelect in Python (with BD: Postgres)
I am unable to select in the Postgresql database. Python 3. conn = psycopg2.connect(host="localhost", dbname='postgres', user='postgres', password=postgres) cur = conn.cursor() cur.execute("select…
-
1
votes2
answers59
viewsProblems with array type?
I’m having trouble formulating a chart. I have basically 2 fields: categorias and dados. Within categorias, the information must be so: ['categoria 1', 'categoria 2', 'etc'] in quotes and separated…
-
1
votes1
answer202
viewsHow to update column for each SELECT in a given table?
I tried to create a trigger for a table using for it to be activated after each select, but researching a little I discovered that it is not possible to create triggers for selections, only for…
-
1
votes1
answer103
viewsHow to audit records by saving changes in JSON
I’m using a function to audit records at Insert, update, delete events for a Postgres 9.6. I got the script on Git - Audit-Trigger The script has been implemented and is working perfectly, but one…
-
1
votes1
answer533
viewsRichedit Delphi messes up text when writing to Postgresql database
I’ve tried almost everything. I have a system in Delphixe6 with Postgresql, in it I have some Text type fields that I need to record formatted text (bold, italics, background color, etc) like word,…
-
1
votes1
answer247
viewsHow to insert this text in Postgresql?
I am using a Delphi query and need to insert the text below in a text field {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\froman\fcharset0 Times New…
-
1
votes1
answer309
viewsConcatenate lines with the same code
When executing the query select * from ivr_interacao,ivr_business where ivr_interacao.codigo = ivr_business.idvisita and ivr_business.campanha = 5 order by start_time asc I have the following…
-
1
votes0
answers26
viewsR and SQL - How to join a data.frame in R with a table in SQL?
I have a table in Postgresql that contains the column "cnae". I also have a data.frame in the R with columns "cnae" and "Description". I need to move the "Description" column up to the table in…
-
1
votes1
answer274
viewsClone Dataset (Tzquery) in Delphi 7
Hello, I have an application in Delphi that does the following: Make a query in the Postgresql database using the Zeos Tzquery/Tzconnection components, then scroll through the result and save it in…
-
1
votes2
answers828
viewsDoubt when creating table with dates in postgresql
I have the following table structure: I would need to create a 3° table that would look like this: I have the smallest and longest date in one table and in another table I have changes made, I would…
-
1
votes0
answers20
viewsLarge Object postgresql
Someone knows a replacement function or script for postgres lo_export, my problem is that I am migrating the databases to a server separate from the application and would not like to use folder…
-
1
votes1
answer1180
viewsDocker Database Connection Problem
I migrated my application to a Docker container, it was working all right, until a moment I had to change the bank’s population scripts and recreate the bank, but I had this problem that I do not…
-
1
votes1
answer424
viewsUPDATE with 2 Joins POSTGRESQL
I would like to ask for help with an update on Posrgresql I need to update the value of a column in a table, but that goes through conditions of 2 tables. I tried the code: update proced_conv set…
-
1
votes1
answer191
viewsWhat type used in Postgre to save a large currency field in the format of 000,000,000,000.00
I am developing a web application in Asp.net and need to save a monetary value in decimal format in C# and store it in postgre in Numeric format, and the value is great. It’s a need that came up in…
-
1
votes1
answer37
viewsHow could I do to pick up every day of the current month?
First of all, good morning guys, I would like a little help in filtering out every day of the current month, where I could get from the first to the 30th or 31st of the current month, where I…
postgresqlasked 4 years, 3 months ago joaovictor-bs 21 -
1
votes0
answers86
viewsProblem with the command Rails db:create Undefined Symbol: rb_enc_alias
Whenever I create a project (from scratch) then I give the command db:create Rails to create the database show me this error: LoadError: /var/lib/gems/2.3.0/gems/pg-1.1.0/lib/pg_ext.so: undefined…
-
1
votes0
answers38
viewsConnect to Azure Functions Database (Javascript)
all right? I’ve been facing a constant problem, and I don’t know what else to try to solve it. I created an Azure Function and need to query some data in the database in order to return them as…
-
1
votes1
answer430
viewsSQL Query with multiple arguments
I need to create an SQL query that may or may not have multiple arguments. Example: Pesquisa 1: "João Goiânia" Pesquisa 2: "Goiânia João" Pesquisa 3: "João Advogado Goiânia" The query must go…
-
1
votes1
answer287
viewsHow to check if a connection is "sleeping" in php?
I have the following script: $fp = @fsockopen($IPAddress, $newport, $errno, $errstr, (float) 0.5); if ($fp) { echo("Conectado\n"); } else { echo("Desconectado\n"); } This script checks if a given…
-
1
votes1
answer57
viewsDatagridview with Custom Value Dataset
Hello, good morning, sir. I would like to ask you for help on the following situation: Use the Postgresql database integrated with Visual Studio Enterprise with the package (Npgsql Postgresql…
-
1
votes0
answers34
viewsCross apply in postgres?
I have the following situation CROSS APPLY (select top 1 seq.id_prod, seq.id_emp, seq.localizacao, seq.localizacao_modulo, seq.localizacao_nivel, seq.localizacao_rua, seq.localizacao_vao, qtde from…
-
1
votes2
answers350
viewsHow to configure Postgresql Autoincrement using EF Core
I have a table mapping (Entity Framework Core 2.0) in which the Id field needs to be Autoincrement. The problem is that Postgresql is starting with high value and often jumps to very high sequences,…
-
1
votes1
answer754
viewsDividing sql results in lines through delimiter
Good afternoon, you guys. I have a hard time making a select on a DB postgres here. For some reason, the programmer invented to create a field where if the user input two notes at the same time, the…
-
1
votes2
answers246
viewsPostgres: How to compare json to create audit Trigger and display only differences
According to the structure below, I would like that when it was updated I could memorize only the differences. Example in the table produto I have the fields: prodcodigo = 1 proddescricao = 'FILTRO…
-
1
votes1
answer35
viewsHow to include surplus value in the result of a LIMIT SQL query?
Hello, I have a global HDI table and would like to consult the 10 countries with the highest HDI and to include Brazil (which is not among the 10 largest ones) in this consultation. As a result,…
-
1
votes2
answers682
viewsError while trying to connect to a Postgresql database with Hibernate and Spring Boot
I’m a beginner in Spring Boot and Hibernate, I did a project on Spring Initializr only with the dependencies Web, DevTools e PostgreSQL, but then I added dependency spring-boot-starter-data-jpa, I…
-
1
votes1
answer31
viewsDifferent result in order by with limit
I have problems with the information obtained in 3 queries. First a normal select sorted by date: select id from app_order o order by o.date ; // 30558, 30559, 30560, ... Then one that should bring…
postgresqlasked 6 years, 1 month ago NovoK 708 -
1
votes0
answers1385
viewsTurn rows into columns - Postgresql
I have the following Query: SELECT public.tipocontratoempresa.codigoempresa, CAST ((public.tipocontratoempresa.quantidadehorasmensais * 3) AS Integer) as horastrimestrais,…
postgresqlasked 6 years, 1 month ago R.Santos 2,251 -
1
votes2
answers65
viewsStatement update SQL
Good morning. I have the following SQL running: UPDATE pessoas SET implante = true FROM saida WHERE saida.prontuario = pessoas.prontuario and saida.mes LIKE (date_part('MONTH', CURRENT_DATE) || '%')…
-
1
votes1
answer23
viewsConvert SQL to Laraval Eloquent 5
I’m trying to turn this SQL from the postgres below to the eloquent in the laraval someone has an idea of how it would look? select g.id as group_id, max(g.name) as name, max(g.created_at) as…
-
1
votes2
answers54
viewsTake only the first record of each condition
Good afternoon! I have the following table: How to get only the first record of each id_uni_sching? That is, I need to get the id_sching 534,382 and 524,075 (First time of each id_uni_sching) ?…
-
1
votes2
answers66
viewsJOIN with LIMIT in Query
I have the following tables with the information below: RESERVATION: id| checkin | checkout | titular | valor --+------------+------------+---------+-------- 1 | 2018-09-01 | 2018-09-02 | BOOKING |…
postgresqlasked 6 years ago Laércio Lopes 4,352 -
1
votes1
answer98
viewsPostgresql 10 - Parallel Settings
There are 4 settings to enable the parallel and make the optimizations, but the documentation Postgresql does not say anything about values or calculations. My questions are: 1- How to calculate the…
-
1
votes1
answer37
viewsRun time difference - Postgresql
I need help, I’m a beginner. I want to catch the difference between minutes and seconds between two columns on the same table, tried the cases below but unsuccessfully. I’m trying to make a SELECT…
postgresqlasked 3 years, 8 months ago PrnP 11 -
1
votes1
answer136
viewsSELECT to fill in a field
Good afternoon, I have a table called Pessoa and another Matricula, I need to make a query that returns the fields to me name, license plate and person of them, where name and person are on the…
-
1
votes1
answer83
viewsPostgresql - Trying a rollback in a function
The structure of relation between tables presented below is not the most convenient and technical. Just to illustrate what I need. I have read many articles about Function, Trigger functions and I…
-
1
votes1
answer98
viewsMulti-layered development and business rule
I work with a team developing an ERP and am responsible for issuing reports, of which one of them runs a select in the bank that in tests took more than 2h running, which led to errors and a big…
-
1
votes0
answers70
viewsInteger conversion in Laravel Controller
I have the following data in the controller: $sheets = printerChange::select('folhas'); $sheetsNew = printerChange::select('folhasnew'); $sheetsCompare = (int)$sheetsNew; if(!is_null($sheetsCompare…
-
1
votes1
answer83
viewsSomething wrong with if in Laravel controller
I have a function in a controller of the Laravel, at first it seems to be working well but, when it goes through the part of "if" jumps straight to the "Else", here is the code that is in the…
-
1
votes0
answers36
viewscreate a Rigger to allow you to lend a book only to students who have 'MT' status
the teacher asked to make a Rigger in postgresql, only that can not do no if someone can help me, create Function emprestimo_book() Returns Trigger language plpgsql as $$ Begin if( Insert Loan…
-
1
votes2
answers7225
viewsPostgre query error: ERROR: syntax error at or near "WHERE"
I was working with mysql in this project and the query worked normally. At the moment, I am migrating to postgresql. However, the query stopped working and returned the following error: ERROR:…
-
1
votes0
answers19
viewsAccess XML value in Postgresql
I need to access the tag value Message of the following xml content: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"…
postgresqlasked 5 years, 11 months ago Zan 21 -
1
votes1
answer224
viewsPostgres: Error converting date in Postgres 10
When I perform a date conversion on postgres 9.6 that I have on my machine, it fixes the date if it is invalid, the same is not happening on postgres 10 that is on another machine: Postgres 9.6…
-
1
votes2
answers964
viewsHow to send variables from one . PHP to another . PHP
Tela login.php, this is the main screen where the user logs in with CNPJ and password. <?php if( isset($_POST['username']) and isset($_POST['password']) ) { include('login.php'); //code is given…
-
1
votes0
answers96
viewsPDO Driver for Postgres Docker, does not install
I set up a PHP + Apache environment using Docker (so far everything OK), however, I noticed that PHP does not come with the PDO_PGSQL driver installed in the image.. I searched, found some solutions…
-
1
votes3
answers1491
viewsORDER BY ASC and DESC at the same time
I need the data you have tr_color = success are ordered in a descending manner DESC and those who do not have it, that the column is empty, be ordered in an Ascending manner ASC. I’m assembling the…
-
1
votes1
answer236
viewsCount returning null value with Query Builder Laravel
I have a problem, I have a query that searches the employee data plus the sum of vacation days and absences that an employee has. The query is working if the employee has some day registered in the…
-
1
votes0
answers82
viewsIs there any problem in persisting an image in postgres and it is of type bytea?
I have an application that was using spring framework version 4 (application that generated a .War full of settings...), it worked plausibly. However, I decided to upgrade to version 5 (using spring…
-
1
votes0
answers63
viewsCatch the start and end of the journey record
I have the following situation: I have the following fiddle, with people’s license plates and registration marks. http://www.sqlfiddle.com/#! 15/1405c/20 I tried to make that second fiddle:…