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
-
5
votes2
answers265
viewsForeign Key between different databases
Is it possible to link two different databases in a Migration? I am using Postgres. What do I have: $table->integer('id_cliente_produto')->unsigned();…
-
5
votes2
answers9742
viewsHow to insert current date in postgresql?
I need to set in a column on postgresql the current date of insertion as the default value for the field. How can I do that?
-
5
votes2
answers3541
viewsWhat command returns the tables that are in LOCK in Postgresql?
What command can I execute to return the tables that are in LOCK in the PostgreSQL. Example query of lock: BEGIN; LOCK TABLE documento_sequencial ... COMMIT;…
postgresqlasked 8 years, 3 months ago Oliveira 1,912 -
5
votes1
answer1448
viewshow to sort by line number in a query in postgres?
To popular the grid of a views I’m using the database, initially I put the table ID to be the view’s Dice, but when some record is deleted from the database the Dice is not sequential.…
-
5
votes1
answer288
viewsStart and Take down bank in flask test
I’m doing an api test, which I pass a json it validates me if it came back all ok: my base class: # -*- coding: utf-8 -*- # base.py import os import unittest from app import initialize from mock…
-
5
votes1
answer164
viewsReturn of SQL command
I need to select in my database all printers compatible with a selected supply, for example, the code supply 155 who is called 50FOZ00. I do the query below to select all compatible printers: SELECT…
-
5
votes2
answers86
viewsHow does ORDER BY draw columns in case of a repeated value?
Suppose I make one SELECT sort of like this: SELECT * FROM "users" ORDER BY "createdAt"; In this context, if I have data that has the same value in the field createdAt, how SQL will sort these…
-
5
votes1
answer58
viewsWhat is the $$ function in posntegresql functions?
Hello, I’m a beginner in postegrsql and I have the following question: When we create functions in postgresql the following logic is usually used CREATE FUNCTION func() RETURNS ret AS $$ BEGIN ...…
-
5
votes1
answer647
viewsHow to deal with multiple quotes in R?
My problem is using quotes in a query within a R function. I have to call a list of select * from probes."probes_90_2018-05" For that I do: coelho<-dbConnect("PostgreSQL", fnord)…
-
5
votes1
answer41
viewsSelect by days of the month returning 0 when there is no record of that day
I have a company call database, for example let’s say the table has only: -- TABELA CHAMADO -- id (id do chamado) inicio (data de inicio do chamado) id_criador (id do usuário que abriu o chamado)…
-
4
votes1
answer138
viewsSQL method for login
I have the following scheme: JdbcRowSet myrs = new JdbcRowSetImpl(); myrs.setUrl("jdbc:postgresql://localhost:9999/teste"); myrs.setUsername("postgres"); myrs.setPassword("");…
-
4
votes1
answer347
viewsGroup tables into a single
We are updating a system developed in Delphi q stored the data in access tables for Postgresql. So far so good, however, I have come across the following situation:: In the old bank we had the…
-
4
votes2
answers798
viewsSyntax error when creating table in Postgresql using Hibernate
@Entity public class User { @Id @GeneratedValue private int id; private String name; private String email; private String sex; private int age; private Date birthday; private Date registerdate;…
-
4
votes1
answer315
viewsHow to properly step data type by PDO
In the php section below, what is the type of PDO::PARAM should I use ? $cnx = new PostgreSQL(); //Classe de conexão do banco $data = '2015-02-13'; $select = 'SELECT * FROM eventos WHERE "data" =…
-
4
votes1
answer1246
viewsIn Postgresql, which field to use for percentage?
In the table that I am creating, I will have a column that will indicate the discount percentage, for example, "for a given agreement I will have 20% discount, for another agreement I will have 50%…
-
4
votes2
answers370
viewsHow to select from a night period (18hrs to 6hrs)
Description: Count how many times the action occurred in the night period considering the time from 18:00 to 06:00 in the morning. There is a better way to select this type without having to use or…
-
4
votes1
answer2185
viewsInsert cities into database
Hello, I am creating a database, and in it I will have information of Brazilian municipalities, I imagine that I am certainly not the first to need this information, however I do not know if there…
-
4
votes1
answer75
viewsWhen should I create a Constraint like DEFERRED?
As far as I know, creating a Constraint (like a foreign key or a check) like DEFERRED makes it only validated at the end of the transaction. What is this used for? And when it should not be used?…
-
4
votes2
answers878
viewsSelect with null Postgresql field
I have the following select SELECT u FROM User u WHERE lower(u.fullname) || lower(u.username) || lower(u.email)) LIKE %:pesquisa% It turns out I want to do the search for any of the 3 existing…
postgresqlasked 9 years, 10 months ago Fernando 227 -
4
votes1
answer2877
viewsHow to change location in Postgresql
My database is with locale en_US.UTF-8, I need to change it to pt_BR.UTF-8 for the purposes of ordering consultations. How can I do that only with phpPgAdmin?…
-
4
votes2
answers1552
viewsSQL query with array type in Postgresql
How to filter this field of type array in Postgresql? I have a table X with a field Y of the kind character varying[] with two records: {'meeting','lunch','training','presentation'}…
-
4
votes2
answers1125
viewsSql - Delete Bulk Records - Delete Bulk
I have a table with about 4 million records. What is the best method to delete all of them to get the best time? Indexing helps something, since it is only a reference to find data? OBS `DELETE FROM…
-
4
votes3
answers309
viewsPostgres SQLSTATE[42725]: Ambiguous Function
I am trying to perform the update to follow using Postgres but I am coming across the following message. Does anyone know a way to resolve? "SQLSTATE[42725]: Ambiguous Function: 7 ERROR: operator is…
-
4
votes1
answer1886
viewsSQL: How to Count Values in Different Columns
I would like to know how to count values in different columns. Generic example: ID - COLUNA1 - COLUNA2 1 - foo - Bar 2 - - Foo 3 - Qux - Bar 4 - Bar - I hope as a result count - value 2 - Foo 3 -…
-
4
votes2
answers567
viewsTest without "fouling" (adding data) the database
I am having trouble doing integration testing. I test my database functions. My web application does not use any framework database connection and I am unable to do tests without fouling my…
-
4
votes2
answers300
viewsImport . sql from Postgresql in Neo4j
I have a Postgresql . sql backup file and want to import that file to Neo4j (graph database). How do I?
-
4
votes1
answer688
viewsAmbiguous column - Laravel 5.1
Good morning! Here’s the thing... I have these 2 tables in my postgresql database: tipos_risco --id --nome agentes_risco --id --nome --id_tipo_risco (foreign key) The problem is I’m not getting the…
-
4
votes1
answer324
viewsInitial Value Sequences Postgresql - Laravel 5.1
Good morning, I am running some tests on my application, but I have the following problem: After the migrate and the db:seed, whenever I will enter some record by applying a duplicated primary key…
-
4
votes1
answer854
viewsLaravel Undefined column: 7 ERROR: column "1" does not exist
In the join, I am passing a direct value, and Laravel is trying to "read" this value as if it were a table. function ($join) { $join ->on('e.pee_fk_pes_codigo', '=', 'p.pes_codigo')…
-
4
votes2
answers758
viewsAverage between timestamp dates
I have 3 dates: 2016-08-17 12:29:01 2016-08-17 12:34:13 2016-08-17 12:39:26 And I would like to get the average time between them. If there are more than 60 seconds, then in minutes, and the same…
postgresqlasked 8 years, 5 months ago Jonathan 1,073 -
4
votes1
answer165
viewsI can’t save the information to a local database!
I’m having trouble saving the information typed by the user in the Postgresql database, I developed an application in Android Studio and I’m using an external local database with Postgresql to store…
-
4
votes1
answer747
viewsSilent installation of Postgres and creation of the installer base
How I can embed the Postgresql database in my Winforms system installer? I can even put it as a prerequisite to install before system binaries, however I wanted to do a silent installation. I would…
-
4
votes1
answer365
viewsString combination in SQL
I need to generate all combinations of a word varchar of a database record. I need to develop in MySQL in PostgreSQL To make it simpler: TABLE DADOS_BASE How to make a process/Function that selects…
-
4
votes2
answers12845
viewsHow to get the names of all Postgresql database tables?
How to get the names of all Postgresql database tables? How to get the attributes(code, name, etc...) of a given table in the Postgresql database?
-
4
votes1
answer376
viewsWhat is Multi-version Concurrency Control in Postgresql?
What is Multi-version Concurrency Control (MVCC) in Postgresql and how it works?
-
4
votes2
answers160
viewsError adding BD information
When testing in the application where I migrated the BD from Firebird to Postgresql the following error occurs when trying to save an item in the database: Reviewing the code I could see that the…
-
4
votes1
answer9873
viewsHow to backup a Postgresql database via pgAdmin 4
I am trying to generate a backup of my Postgresql database through pgAdmin 4, but every time I try to backup an error occurs: I am configuring the Postgresql preferences as follows: And when I set…
-
4
votes1
answer5011
viewsError Connection Database; "relation does not exist"
I am having Problem to Save Data from a Screen to my database I am getting the following error: "org.postgresql.util.PSQL.Exception: ERROR: column "name" of relation "product registration" does not…
-
4
votes1
answer247
viewsImport txt file into Postgresql 9.6
Guys, I have the following problem: I have a file in txt format with the following information: 1;Helder;Masculino;GO 2;João;Masculino;RJ 3;Maria;Feminino;PR 4;Pedro;Masculino;MA I used this example…
-
4
votes3
answers3856
viewsReturn month name as select
I need to return the name of the month with the command select, I know with command Select extract('Month',data) He returns me the number of the month in question, there is a way to bring the number…
postgresqlasked 6 years, 11 months ago R.Santos 2,251 -
4
votes1
answer524
viewsHibernate is not creating or updating BD tables
I have the classes Beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"…
-
4
votes1
answer456
viewsProblems restoring a Postgresql database with C#
private void btnRestore_Click(object sender, EventArgs e) { if (clsB.ConectaBanco()) { //Executo a seguinte função para limpar a base de dados, para poder dar o restore. clsB.ExecutarSQL("drop…
-
4
votes1
answer48
viewsquery executes in the database but in the project points error
I have a query native: SELECT dist.nome Distrito, enti.nome Entidade, dist.id_distrito, dist.codigo_dne, dist.id_entidade, dist.id_municipio, dist.id_uf, dist.flag_ativo, muni.nome Municipio,…
-
4
votes2
answers1593
viewsHow to insert sequence in non-automated field
I need to insert records in a table with data from another continuing the sequence of a column that already exists in it, but the column I want to continue the sequence is not auto-incremented and…
-
4
votes1
answer1359
viewsPostgresql md5 encryption
I am creating a table using Postgresql and there will still be a password field with MD5 encryption. What would the syntax look like in it? Because I have more contact with Mysql than Postgresql.…
-
4
votes3
answers437
viewsPostgresql 8 - Replace the first occurrence of a character in a string
I have a field in a table in a Postgresql 8 database whose values are strings and have hyphens in some irregular positions. I would like to replace the first occurrence of the hyphen in the string…
postgresqlasked 6 years, 9 months ago Eduardo 43 -
4
votes3
answers902
viewsRETURN THE SUM OF MAXIMUM 3 SQL VALUES
I have a table and I need to return the following: check based on recipient column, add the 3 largest amount of that recipient, bring in query only if the sum of the 3 largest ones are >= 1024:…
-
4
votes2
answers3999
viewsHow to define the SET CLIENT_ENCODING = UTF8 permanently?
I am using Postgresql in my DATABASE Accent information is being recorded with accent problems. Ex: It records like it is. Shark records as Shark The encoding of my DATABASE and my server are using…
-
4
votes1
answer2433
viewsPostgresql - Partial Foreign Key of Composite Primary Key
Fala galera, I need to create a structure model where all my tables have primary key composed by id and version, so I can have multiple versions for each id. Problem: CREATE TABLE table1 { id…
-
4
votes0
answers139
viewsProject flyway and jpa-Ibernate getting confused
In the project we are creating, on site, to the initial JPA - Ibernate, created the tables and inserted some information, for tests. Well the project was growing and we decided to include the flyway…