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
-
3
votes1
answer388
viewsConnect Postgresql to Delphi 7 through Zeoslib
I’m trying to connect Postgresql in Delphi 7, I found in a forum the idea of using Zeoslib to make this connection watching a video class I reached this setting: But even following step by step how…
-
3
votes1
answer142
viewsNullreferenceexception when calling function
I’m creating some unit tests for a class library that does manipulations in a database. The method being tested is this: public object ExecuteNoQueryOperation ( string spOrSqlInstructions,…
-
3
votes2
answers616
viewsPostgresql Trigger apos update
Let’s imagine the following scenario: CREATE TABLE invalido ( ds_valor character varying(255) ) CREATE TABLE email ( email character varying(255) ) now I need a trigger that every time I run a…
-
3
votes2
answers381
viewsSELECT issues with postgresql
I am making a migration from mysql to postgres, but there is an error happening, not much experience with postgres: SELECT SELECT m.* , (SELECT c.id FROM corridas c WHERE c.motoqueiro = m.id AND…
-
3
votes3
answers756
viewsHow to remove duplicate data in this query?
Eai personal blz? Next I’m using this query: select products.id as product_id, offers.id as offer_id, companies.id as company_id, products.title, (ST_Distance(companies.location, 'POINT(-48.030322…
-
3
votes1
answer59
viewsHow to select double contacts from a table
I have 2 tables : Users [id, name, etc ...] Friends [id, idUsuario, idAmigoI] In the Friends table, idUsuario corresponds to the id of the user who has the contact and idAmigo the id of the user who…
-
3
votes1
answer278
viewsHow to calculate cumulative total of 365 days joining two different years?
I’m trying to verify the accumulated total of a certain amount, which starts in September of a year and goes through August of the following year, and then starts again. I’m doing this with a long…
-
3
votes1
answer467
viewsConnect with Postgresql
I have a file *.ini which connects to my Firebird database, but now I need this file configured to connect to Postgresql [IBConnection] DriverName=Interbase…
-
3
votes1
answer750
viewsPostgress Crosstab - Return and sql tuple descriptions are incompatible
I’m trying to use Crosstab in postgres but... CREATE TABLE tb_testect ( datahora timestamp without time zone, teste integer ); * Correction INSERT INTO tb_testect VALUES (TIMESTAMP '2016-01-01…
-
3
votes3
answers6801
viewsFiredac Connection with Postgresql DLL Error
I’m with DLL error not found when making a connection to Postgresql using the Firedac component. Error: [Firedac][Phys][PG]-314. Cannot load vendor library [C: EXE libpq.dll]. Hint: check it is in…
-
3
votes1
answer188
viewsCreating Function Postgresql
I’m having a problem creating a Function. I am pulling its parameters from my java application, the problem occurs when pulling the parameters ( variavel1, and variavel2) because they are coming…
-
3
votes1
answer101
viewsAlgorithm for popular tables in Postgressql
I am writing an algorithm to popular all tables in a database in Postgres. I already get popular all tables who have no relationship, as follows: I get all tables with the following query: SELECT…
-
3
votes2
answers649
viewsProblem with connection between EF and Postgresql
I am trying to make a connection with EF and Postgresql in an Asp.Net Mvc application I am using the following references Entityframework6.Npgsql Npgsql 3.1 .NET Framework 4.5 I have the following…
-
3
votes3
answers345
viewsDynamic search in c# and WPF
Good morning I would like to ask a question about a dynamic research. Setting: I have a search screen, where the user selects 3 fields, being them: The first is the search screen field, where you…
-
3
votes2
answers2800
viewsHow to get the records from the last 15 days - Postgresql
I have a table called Entrega where all deliveries made with their respective dates are stored, how can I bring only deliveries from the last 15 days? Doing so I can bring deliveries from the day 10…
-
3
votes2
answers985
viewsProblem while recovering null data to a Datatable in C#
I am working with C# and the Postgresql Database, I have a field of type Date where it can be filled dd/mm/yyyy or null empty. the same problem refers to any field of the table, if it is empty, even…
-
3
votes1
answer205
viewsImplement Triggers in Postgre
It has how to implement a Rigger to work in a column that is present in all tables of the database?
-
3
votes3
answers952
viewsSave date in Brazilian format in Postgresql
I have a Postgresql database on the Windows Azure server that is set to the Brazilian standard. If I do an SQL and run directly in Pgadminiii there from the server and run, the date is saved in…
-
3
votes2
answers495
viewsSeparate a column of the database in two and take the values of users already created
I have a table of users in the database with a column NAME, but it will be necessary to separate between NAME and SURNAME. My question is: will users already created in the bank have to be edited…
-
3
votes2
answers1482
viewsSQL: Doubt in the Relationship between Tables
I am creating an academic system that consists of a virtual restaurant menu type, for this, I created three tables in the bank: Table of Menu Items: CREATE TABLE ITEMS( ID INT PRIMARY KEY NOT NULL,…
-
3
votes3
answers144
viewsHelp with select
I’m using the remote select down below: select f.no_equipe, h.no_pessoa_fisica, a.no_cidadao, d.dt_ficha from tb_cds_cad_individual a, tb_cds_atend_individual b, rl_cds_atend_individual_ciap c,…
-
3
votes2
answers72
viewsWhy is OR not good in a LEFT JOIN?
I’m creating a query and my pull request returned because the Code Star considered that the OR is not good for relationship tables. Example: FROM LEFT JOIN administracao.cidade cid ON…
-
3
votes1
answer213
viewsString postgresql manipulation?
I’d like to manipulate a String with regexp_replace as follows: String to manipulate: 'TESTE <<TESTE1>> TESTE <<TESTE2>>' String after function: 'TESTE TESTE' I tried it this…
-
3
votes0
answers216
viewsapache/nifi Docker and postgresql Driver
I pulled apache/nifi on the Docker hub. I start the container, but I can’t configure the connection with postgres, It triggers an exception that cannot load the Database Driver. I copied the file .…
-
3
votes1
answer1083
viewsHow to add the numbers of a column in the bank that has the same id and repeats?
I have a table called venda_itens that has venda_id, item_id and item_quantidade. I wanted to bring back the item name with the total amount of items sold, and to amount of total items, through a…
-
3
votes1
answer523
viewsReplication of a database
I have read some articles on database replication and mirroring, but a doubt I still have, and I did not find a "concrete" answer would refer and update the database. For example: I have MASTER and…
-
3
votes1
answer1406
viewsHow to see which tables are accessed in postgresql?
How to view the tables being accessed by the select command ? EX: select *from pg_stats I would like to get the tables that are having more access on a given day in the database.…
postgresqlasked 6 years, 5 months ago Beto 937 -
3
votes1
answer32
viewsMigration Conventions
I have an MVC DDD application that uses Sqlserver. I’m trying to get the database to Postgressql, but there is a FK duplicity error. For example, the default Sqlserver would be generated:…
-
3
votes1
answer941
viewsCircumvent primary key duplication error
Hello, I have the following script, . sql, to create a table and also create a Trigger. SET client_encoding TO 'LATIN1'; CREATE OR REPLACE FUNCTION before_insert() RETURNS trigger AS ' DECLARE n…
-
3
votes1
answer32
viewshow to create a postgresql table? how do you use alter table and drop table? and what are the differences between Primary key and Foreign key?
People help me with postgresql studies.How do you create a postgresql table? how do you use the alter table and drop table? and what differences of key Primary and key Foreign ?
-
3
votes2
answers1247
viewsSQL Error [42601]: ERROR: syntax error at or near "Foreign"
When creating this table in postgre sql I get this error message Table creation tipo_agendamento_escritorio create table tipo_agendamento_escritorio( id int8 not null, primary key (id),…
-
3
votes2
answers549
viewsReturn default value if no record
I have the following sql command of select: SELECT public.controleimpressoes.codigo, public.impressoras.patrimonio, public.impressoramodelo.modelo, public.impressoralocal.descricao, (select…
postgresqlasked 6 years, 10 months ago R.Santos 2,251 -
3
votes1
answer2430
viewsError Response from daemon: failed driver External Connectivity on endpoint
Someone’s been through this mistake? I’m trying to run the postgres via Docker but prints an error. sudo docker start database Error response from daemon failed programming external connectivity on…
-
3
votes1
answer2921
viewsPercentage Postgresql
I cannot perform the percentage of this query . You should take the sum of "valor_convenio" of each municipality and divided by the total sum of the "valor_convenio" : <h3>Entrada SQL SEM…
-
3
votes2
answers74
viewsSelect to Alias
I’m trying to establish a select to be a alias of a record. I do not know yet if there is such a possibility, could someone clarify me this doubt? ex: select 1 as (select dia_da_semana from ano…
-
3
votes2
answers1174
viewsSum values of several lines under condition
Good afternoon gentlemen, I have a query that returns to me some precise fields of their sum, only that in a condition select adm.adm_ds_administradora as descricao, sum(car.car_vl_cartao) as valor,…
-
3
votes1
answer2462
viewsSearch with accents and without accents Postgresql
Hello, I am trying to search through a field in the application, it searches the word in the database (postgres), however, has a lot of product registered in the bank, with and without accent, for…
-
3
votes1
answer93
viewsHow to merge several updates into different tables?
I have 3 updates, and the tables that I have to give the updates have over 2 million records, so it would be impossible to do one by one, since each takes more than half an hour to run, and waiting…
-
3
votes1
answer43
viewsSort by month without repeating the year
I would like to add the total sales in the month, but without repeating the year. select EXTRACT(year FROM v.dataVenda), case when EXTRACT(MONTH FROM v.dataVenda) =1 then sum(v.valorvenda) else 0…
-
3
votes1
answer50
viewsReturn text sql to model in the Entity framework
I have the parent class and the state class: [Table("tb_pais")] public class PaisModel { [Key] [Column("id")] public int Id { get; set; } [Column("nome")] [Required(ErrorMessage = "O campo nome é…
-
3
votes2
answers44
viewsWhat is the "~*" operator for in a select in SQL?
I saw this line of code in some examples: SELECT * from produto where nome ~*'$texto_pesquisado';" But I don’t know what the function of ~*, I found no explanation. What is it for?…
-
3
votes1
answer99
viewsError changing table in Postgresql. How do I change the type of an int column to the timestamp type?
I’m studying the Postgresql comic book for a recent book I acquired. When trying to change a tebela based on the command I learned in the book an error occurred, I used exactly the same command…
-
3
votes2
answers835
viewsHow to make an auto ID increment relative to another field in Postgresql "Postgresql"?
Personal it has been a long time since I look for a way to do this, what would be the correct way to make an auto increment that depends on another field as in the example below? id_empresa |…
-
3
votes1
answer171
viewsINSERT INTO in Postgresql with random values
Hello. My problem is basically a popular table in Postgresql with randomly generated data. As the SQL commands are quite extensive I would like to complement this table gradually. The table has the…
-
3
votes1
answer370
viewstake the status of pg_query and pass to php variable
Imagine the following consultation: pg_query($conn,"selects * from tabela"); Considering there’s a mistake in selects, 'ERROR: syntax error at or near "selects" LINE 1: selects * from table... ^'…
-
3
votes2
answers358
viewsHow can I select unique data in SQL?
Hello would you like to know how can I select unique data in SQL? I have an Excel spreadsheet that has the daods that I need to extract information by applying the following filter in sql: GSM which…
-
3
votes1
answer725
viewsLogic SELECT CASE WHEN
would like help in building the following logic: I have my main table and two other tables A and B, which have foreign key from the main. When an X column is filled in table A I need to classify my…
-
3
votes2
answers332
viewsTreatment of Python Images
I have a question here of architecture: The application we are building has a load of images pro system. They are photos of ads, and each one can upload 12 photos. These ads are dynamic, meaning…
-
3
votes2
answers79
viewsCreating routers for multiple databases in Django
I am developing a Django application where I need several Databases, one for each user of the system. For this I set the Databases like this: DATABASES = { 'default': {}, 'primary': { 'NAME':…
-
3
votes1
answer148
viewsGet a result that appears in 1st position if you have a value specified in SQL
I need to create a query that follows some rules and they are: gsm repeat sending be different status who is with ANOMALY and appears as the first result (over the others) I’ll give you an example…