postgresql

pid file disappears after starting pgpool with ubuntu and postgresql

五迷三道 提交于 2021-01-27 06:25:11
问题 I´ve installed postgresql 9.1 on ubuntu 12.04 with pgpoolII-3.3.3 and pgPoolAdmin If I try to run pgpool from a terminal with sudo pgpool it seems to start. Viewing ubuntu file explorer I can see how a pgpool.pid file is created at /var/run/pgpool/pgpool.id (this is the path in pgpool.conf) But after one second the file disappears. I have tried to change the owner of the directory and the directory permissions but nothing seems to fix it. If after that I try to stop pgpool wiht sudo pgpool -m

pid file disappears after starting pgpool with ubuntu and postgresql

随声附和 提交于 2021-01-27 06:25:08
问题 I´ve installed postgresql 9.1 on ubuntu 12.04 with pgpoolII-3.3.3 and pgPoolAdmin If I try to run pgpool from a terminal with sudo pgpool it seems to start. Viewing ubuntu file explorer I can see how a pgpool.pid file is created at /var/run/pgpool/pgpool.id (this is the path in pgpool.conf) But after one second the file disappears. I have tried to change the owner of the directory and the directory permissions but nothing seems to fix it. If after that I try to stop pgpool wiht sudo pgpool -m

Why are the result of COUNT double when I do two join? [duplicate]

巧了我就是萌 提交于 2021-01-27 06:07:23
问题 This question already has answers here : sql double count in join statement (2 answers) Closed 3 years ago . I have this tables device id name groupId serviceId 791 Mamie Ortega 205 1832 group id serviceId 205 1832 record id date deviceId 792 2017-07-13 13:30:19.740360 784 793 2017-07-13 13:30:19.742799 784 alarms id status deviceId 241 new 784 242 new 784 I'm running this query SELECT device.id, device.name, COUNT(records.id) AS "last24HMessagesCount", COUNT(alarms.id) AS "activeAlarmsCount"

Why are the result of COUNT double when I do two join? [duplicate]

孤街浪徒 提交于 2021-01-27 06:07:13
问题 This question already has answers here : sql double count in join statement (2 answers) Closed 3 years ago . I have this tables device id name groupId serviceId 791 Mamie Ortega 205 1832 group id serviceId 205 1832 record id date deviceId 792 2017-07-13 13:30:19.740360 784 793 2017-07-13 13:30:19.742799 784 alarms id status deviceId 241 new 784 242 new 784 I'm running this query SELECT device.id, device.name, COUNT(records.id) AS "last24HMessagesCount", COUNT(alarms.id) AS "activeAlarmsCount"

List tables within a Postgres schema using R

折月煮酒 提交于 2021-01-27 06:05:06
问题 I'm connecting to a PostgreSQL db using R and the RPostgreSQL package. The db has a number of schemas and I would like to know which tables are associated with a specific schema. So far I have tried: dbListTables(db, schema="sch2014") dbGetQuery(db, "dt sch2014.*") dbGetQuery(db, "\dt sch2014.*") dbGetQuery(db, "\\dt sch2014.*") None of which have worked. This related question also exists: Setting the schema name in postgres using R, which would solve the problem by defining the schema at the

List tables within a Postgres schema using R

妖精的绣舞 提交于 2021-01-27 06:00:00
问题 I'm connecting to a PostgreSQL db using R and the RPostgreSQL package. The db has a number of schemas and I would like to know which tables are associated with a specific schema. So far I have tried: dbListTables(db, schema="sch2014") dbGetQuery(db, "dt sch2014.*") dbGetQuery(db, "\dt sch2014.*") dbGetQuery(db, "\\dt sch2014.*") None of which have worked. This related question also exists: Setting the schema name in postgres using R, which would solve the problem by defining the schema at the

typeorm postgres select where json field equals some value

半世苍凉 提交于 2021-01-27 05:40:16
问题 Goal: write a select query that returns all rows where state equals "florida". Entity column: @Column({ type: 'json'}) public address: Address; Sample column value: {"city": "miami", "state": "florida"} Example query (doesn't work): getManager().getRepository(User) .createQueryBuilder('user') .select() .where('user.address.state =:state', {state: "florida"}) Is this functionality currently supported in typeorm? If so, how would I need to modify my where clause to return the correct rows? 回答1:

Django + PostgreSQL: Fill missing dates in a range

℡╲_俬逩灬. 提交于 2021-01-27 05:31:42
问题 I have a table with one of the columns as date . It can have multiple entries for each date. date ..... ----------- ----- 2015-07-20 .. 2015-07-20 .. 2015-07-23 .. 2015-07-24 .. I would like to get data in the following form using Django ORM with PostgreSQL as database backend: date count(date) ----------- ----------- 2015-07-20 2 2015-07-21 0 (missing after aggregation) 2015-07-22 0 (missing after aggregation) 2015-07-23 1 2015-07-24 1 Corresponding PostgreSQL Query: WITH RECURSIVE date_view

Django + PostgreSQL: Fill missing dates in a range

老子叫甜甜 提交于 2021-01-27 05:30:56
问题 I have a table with one of the columns as date . It can have multiple entries for each date. date ..... ----------- ----- 2015-07-20 .. 2015-07-20 .. 2015-07-23 .. 2015-07-24 .. I would like to get data in the following form using Django ORM with PostgreSQL as database backend: date count(date) ----------- ----------- 2015-07-20 2 2015-07-21 0 (missing after aggregation) 2015-07-22 0 (missing after aggregation) 2015-07-23 1 2015-07-24 1 Corresponding PostgreSQL Query: WITH RECURSIVE date_view

Why can't two tables have an index of the same name?

纵饮孤独 提交于 2021-01-27 05:26:45
问题 I'm creating indexes on two separate tables in the same DB (PostgreSQL), and I got an error saying that an index already exists. This was true, however, the index existed on a different table. After changing the name, it worked. I'm wondering why this is the case? Why are databases designed such that two tables can't have the same name of an index? I found two sources that answer this, although the answers are different. One is for MySQL, the other is for Postgres: In postgres how do I add