postgresql

PG::ConnectionBad: FATAL: Peer authentication failed for user 'username' error

雨燕双飞 提交于 2021-01-27 12:35:23
问题 When I try to connect to my pg database using User.connection or generic-table.connection I get this error PG::ConnectionBad: FATAL: Peer authentication failed for user 'username' I double checked my database.yml and it looks good. I think the problem lies with my pg_bha.conf file? I can not find this file in my app or my system right now. database.yml development: adapter: postgresql encoding: utf8 database: project_development pool: 5 username: password: test: &TEST adapter: postgresql

SQL: select one record for each day nearest to a specific time

二次信任 提交于 2021-01-27 12:22:59
问题 I have one table that stores values with a point in time: CREATE TABLE values ( value DECIMAL, datetime DATETIME ) There may be many values on each day, there may also be only one value for a given day. Now I want to get the value for each day in a given timespan (e.g. one month) which is nearest to a given time of day. I only want to get one value per day if there are records for this day or no value if there are no records. My database is PostgreSQL. I'm quite stuck with that. I could just

Use debezium link postgresql 11 Couldn't obtain encoding for database test

非 Y 不嫁゛ 提交于 2021-01-27 11:58:15
问题 I use debezium cdc connect pg, and i build the pg 11 use by docker,the pg is run well. when i use debezium in kafka connector, it report: Couldn't obtain encoding for database test the curl is: curl -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8083/connectors/ -d '{ "name": "debezium", "config": { "name": "debezium", "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "tasks.max": "1", "database.hostname": "localhost",

Use debezium link postgresql 11 Couldn't obtain encoding for database test

百般思念 提交于 2021-01-27 11:56:08
问题 I use debezium cdc connect pg, and i build the pg 11 use by docker,the pg is run well. when i use debezium in kafka connector, it report: Couldn't obtain encoding for database test the curl is: curl -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8083/connectors/ -d '{ "name": "debezium", "config": { "name": "debezium", "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "tasks.max": "1", "database.hostname": "localhost",

Use debezium link postgresql 11 Couldn't obtain encoding for database test

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-27 11:54:30
问题 I use debezium cdc connect pg, and i build the pg 11 use by docker,the pg is run well. when i use debezium in kafka connector, it report: Couldn't obtain encoding for database test the curl is: curl -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8083/connectors/ -d '{ "name": "debezium", "config": { "name": "debezium", "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "tasks.max": "1", "database.hostname": "localhost",

TimescaleDB query to select rows where column value changed from previous row

两盒软妹~` 提交于 2021-01-27 11:48:46
问题 Just recently started using TimescaleDB with postgrest to handle most requests for data. However I'm running into an issue where I have a horribly inefficient request for time series of data. It's a data series that can be any length of time, with specific Integer values. Most of the time the value will be the same unless there's an anomaly. So rather than fetching +10,000 rows of data. I would like to aggregate this into "time blocks". Let's say there 97 items in a row where the value is 100

TimescaleDB query to select rows where column value changed from previous row

只愿长相守 提交于 2021-01-27 11:43:23
问题 Just recently started using TimescaleDB with postgrest to handle most requests for data. However I'm running into an issue where I have a horribly inefficient request for time series of data. It's a data series that can be any length of time, with specific Integer values. Most of the time the value will be the same unless there's an anomaly. So rather than fetching +10,000 rows of data. I would like to aggregate this into "time blocks". Let's say there 97 items in a row where the value is 100

PostgreSQL - \copy command

天大地大妈咪最大 提交于 2021-01-27 11:25:45
问题 I tried the above code. I manage to Compile. However, when I run, it give me error: Exception in thread "main" org.postgresql.util.PSQLException: ERROR: syntax error at or near "\" Position: 1 It shows that the query that I run is wrong: String query ="\\COPY tmp from 'E:\\load.csv' delimiter ',';"; The System.out.println for the query is: query string: \COPY tmp from 'E:\load.csv' delimiter ','; I run the query : \COPY tmp from 'E:\load.csv' delimiter ','; in PostgresSQL client, it works.

PostgreSQL - \copy command

亡梦爱人 提交于 2021-01-27 11:24:13
问题 I tried the above code. I manage to Compile. However, when I run, it give me error: Exception in thread "main" org.postgresql.util.PSQLException: ERROR: syntax error at or near "\" Position: 1 It shows that the query that I run is wrong: String query ="\\COPY tmp from 'E:\\load.csv' delimiter ',';"; The System.out.println for the query is: query string: \COPY tmp from 'E:\load.csv' delimiter ','; I run the query : \COPY tmp from 'E:\load.csv' delimiter ','; in PostgresSQL client, it works.

Multiple Databases With Rails Not Working For Remote Database

做~自己de王妃 提交于 2021-01-27 11:02:10
问题 I have a remote read-only postgres database that is maintained from a docker instance of cardano-db-sync. I managed to connect the development database to it, it was working fine. But since it is read-only I wanted to add another database for User and other modifiable tables. this is the set up I prepared: # config/database.yml default: &default adapter: postgresql encoding: unicode pool: 5 development: <<: *default primary: database: 'db_sync' cexplorer: database: 'cexplorer' username: <%=