postgresql

How to Build a ubuntu docker container with postgres installed in?

无人久伴 提交于 2021-01-29 14:23:03
问题 Here is the challenge, I've written a program in python with pyqt5 and some others libraries including postgresql, now the question is, how could build a docker ubuntu container with postgresql installed in ? And I have to set up the postgres user as postgres and password as 1234 in order to make everything working well. I'am lost in how to write well the Dockerfile and respecting all exigence. Thanks in advance for the solution and if something wasn't clear ask me a question than I will

how to use JPA Native query and TypedParameterValue to perform count

笑着哭i 提交于 2021-01-29 14:20:14
问题 I have an Entity class and I want to count the number of elements that satisfy some conditions in a PostgreSQL database. The entity contains many columns but I just need a response that returns the count of the selected columns as pending, approved, notSubmitted, submitted, approved, notapproved, queried... In order to avoid type mismatch from PostgreSQL driver, I am using the TypedParameterValue method. However I am getting a null value as a response instead of the actual value that should

Postgresql and primary key, foreign key indexing

坚强是说给别人听的谎言 提交于 2021-01-29 14:15:58
问题 On https://stackoverflow.com/questions/10356484/how-to-add-on-delete-cascade-constraints#= a user, kgrittn, commented saying that But I notice that you have not created indexes on referencing columns... Deletes on the referenced table will take a long time without those, if you get many rows in those tables. Some databases automatically create an index on the referencing column(s); PostgreSQL leaves that up to you, since there are some cases where it isn't worthwhile. I'm having difficulty

pg_dump with --exclude-table still includes those tables in the background COPY commands it runs?

只愿长相守 提交于 2021-01-29 13:52:46
问题 I am trying to take a backup of a TimescaleDB database, excluding two very big hypertables. That means that while the backup is running, I would not expect to see any COPY command of the underlying chunks, but I actually do! Let's say TestDB is my database and it has two big hypertables on schema mySchema called hyper1 and hyper2 , as well as other normal tables. I run the following command: pg_dump -U user -F t TestDB --exclude-table "mySchema.hyper1" --exclude-table "mySchema.hyper2" >

SQL statement working in MySQL not working in Postgresql - Sum & group_by rails 3

淺唱寂寞╮ 提交于 2021-01-29 13:29:06
问题 So I'm very new to working in SQL in general, let alone rails but I have this statement that works in MySQL: portfolio_values.select("portfolio_values.*, SUM(portfolio_values.value) as totals").group("portfolio_values.day").map(&:totals) But in postgresql is throws this error: GError: ERROR: column "portfolio_values.id" must appear in the GROUP BY clause or be used in an aggregate function : SELECT portfolio_values.*, SUM(portfolio_values.value) as totals FROM "portfolio_values" WHERE

Different Default ordering between ORACLE and PostgreSQL

…衆ロ難τιáo~ 提交于 2021-01-29 13:17:46
问题 I have a simple ORACLE Query which I should rewrite it to be run on postgresql with same output as below Select X,Y FROM table_name order by Y in case of I have only the below data in the table Here you are the difference between PG and oracle in ordering the data Do you have idea why such this difference occurs? 回答1: Different Default ordering There is no such thing as "default ordering" - neither in Oracle nor in Postgres (or in any other relational database). Tables in a relational

SQL: Full outer join or Union or neither?

主宰稳场 提交于 2021-01-29 13:12:07
问题 I have an A_to_C table which is many-to-many join table between A and C ╔═══════╦══════════╗ ║ a_col ║ c_col ║ ╠═══════╬══════════╣ ║ a ║ x ║ ║ b ║ y ║ ║ c ║ z ║ ╚═══════╩══════════╝ I also have a B_to_C table which is many-to-many join table from B and C ╔═══════╦═══════╗ ║ b_col ║ c_col ║ ╠═══════╬═══════╣ ║ g ║ u ║ ║ h ║ v ║ ║ i ║ w ║ ╚═══════╩═══════╝ I want to achieve a result like this: ╔═══════╦═══════╦═══════╗ ║ a_col ║ c_col ║ b_col ║ ╠═══════╬═══════╬═══════╣ ║ a ║ x ║ NULL ║ ║ b ║

Server in docker container unable to connect to postgres database in another docker container

情到浓时终转凉″ 提交于 2021-01-29 13:08:05
问题 I have a node server that's trying to connect to a postgres database using knex. Both are in docker containers with the same custom network. I keep getting ECONNREFUSED errors. I've poked around in the database container and I see that my DB ( test_db ) has been created by psql but it has no permissions. After giving root permissions, I'm still getting the same issues. I've tried removing the volumes with docker-compose down -v but still no luck. I've also tried removing knex and just using

Providing Certificates to Tomcat for Postgres Connection

廉价感情. 提交于 2021-01-29 13:01:21
问题 I am in the process of configuring TLS for Tomcat 8.5, Postgres communication using Self signed Certificate. What would be the best means to provide Certificate, PK (bundled in PKCS12 format) to Tomcat and the CA certificate (root Certificate)? Tomcat is set up as a Service, hence preferred would be to provide start up VM parameters. I have tried to provide these in Configure Tomcat -> Java Opts -Djavax.net.ssl.keyStorePassword=changeit -Djavax.net.ssl.trustStore=D:\test\data\pg_cert

How can I use Postgres collation in Windows OS?

时间秒杀一切 提交于 2021-01-29 12:43:14
问题 I want to customize ICU Collation of Postgres server in my windows machine. so I created a new collation using: CREATE COLLATION digitslast (provider = icu, locale = 'ja-u-kr-latn-digit'); and expected as below. ex) # select code from table order by code collate "digitslast"; code | -----+-- a | ... A | ... 1 | ... ... | ... But result has the same order as the default order. code | -----+-- 1 | ... a | ... A | ... ... | ... Is this possible? And is there some mistake? 来源: https:/