postgresql

How to change max_connections for Postgres through SQL command

和自甴很熟 提交于 2021-02-07 03:15:46
问题 We have a hosted PostgreSQL, with no access to the system or *.conf files. I do have a admin access and can connect to it using Oracle SQL developer. Can I run any command to increase the max_connections. All other parameters seems to be ok shared mem and buffers can hold more connections so there is not problem there. 回答1: Changing max_connection parameter needs a Postgres restart Commands Check max_connection just to keep current value in mind SHOW max_connections; Change max_connection

How to change max_connections for Postgres through SQL command

点点圈 提交于 2021-02-07 03:15:43
问题 We have a hosted PostgreSQL, with no access to the system or *.conf files. I do have a admin access and can connect to it using Oracle SQL developer. Can I run any command to increase the max_connections. All other parameters seems to be ok shared mem and buffers can hold more connections so there is not problem there. 回答1: Changing max_connection parameter needs a Postgres restart Commands Check max_connection just to keep current value in mind SHOW max_connections; Change max_connection

How to apply pagination to the result of a SQL query with Joins?

£可爱£侵袭症+ 提交于 2021-02-07 03:06:52
问题 I have SQL query which joins 3 tables, one being just a many-to-many connecting the other two. I use a Spring JDBC ResultSetExtractor to convert the ResultSet into my Objects which look roughly like this: class Customer { private String id; private Set<AccountType> accountTypes; ... } The ResultSetExtractor implementation looks like this: public List<Client> extractData(ResultSet rs) throws SQLException, DataAccessException { Map<Integer, Client> clientsMap = new LinkedHashMap<Integer, Client

psycopg2: Update multiple rows in a table with values from a tuple of tuples

蓝咒 提交于 2021-02-07 02:00:53
问题 I'm attempting to update several rows at once using a tuple of tuples. I figured out how to construct the sql statement from this post, but implementing it in psycopg2 has proven to be more challenging. Here's what I have: c = db.cursor() new_values = (("Richard",29),("Ronald",30)) sql = """UPDATE my_table AS t SET name = e.name FROM (VALUES %s) AS e(name, id) WHERE e.id = t.id;""" c.execute(sql, (new_values,)) The result is an error: ProgrammingError: table "e" has 1 columns available but 2

knex: what is the appropriate way to create an array from results?

南楼画角 提交于 2021-02-07 01:53:40
问题 I have an endpoint that joins the user and user_emails table as a one-to-many relationship (postgresql). It look as follows. router.get('/', function (req, res, next) { db.select('users.id', 'users.name', 'user_emails.address') .from('users') .leftJoin('user_emails', 'users.id', 'user_emails.user_id') .then(users => res.status(200).json(users)) .catch(next) // go to error handler }); However, this will return a new document for each email address. What I want is an array of documents that

knex: what is the appropriate way to create an array from results?

倖福魔咒の 提交于 2021-02-07 01:46:18
问题 I have an endpoint that joins the user and user_emails table as a one-to-many relationship (postgresql). It look as follows. router.get('/', function (req, res, next) { db.select('users.id', 'users.name', 'user_emails.address') .from('users') .leftJoin('user_emails', 'users.id', 'user_emails.user_id') .then(users => res.status(200).json(users)) .catch(next) // go to error handler }); However, this will return a new document for each email address. What I want is an array of documents that

knex: what is the appropriate way to create an array from results?

孤街醉人 提交于 2021-02-07 01:40:34
问题 I have an endpoint that joins the user and user_emails table as a one-to-many relationship (postgresql). It look as follows. router.get('/', function (req, res, next) { db.select('users.id', 'users.name', 'user_emails.address') .from('users') .leftJoin('user_emails', 'users.id', 'user_emails.user_id') .then(users => res.status(200).json(users)) .catch(next) // go to error handler }); However, this will return a new document for each email address. What I want is an array of documents that

knex: what is the appropriate way to create an array from results?

风流意气都作罢 提交于 2021-02-07 01:40:16
问题 I have an endpoint that joins the user and user_emails table as a one-to-many relationship (postgresql). It look as follows. router.get('/', function (req, res, next) { db.select('users.id', 'users.name', 'user_emails.address') .from('users') .leftJoin('user_emails', 'users.id', 'user_emails.user_id') .then(users => res.status(200).json(users)) .catch(next) // go to error handler }); However, this will return a new document for each email address. What I want is an array of documents that

knex: what is the appropriate way to create an array from results?

十年热恋 提交于 2021-02-07 01:33:40
问题 I have an endpoint that joins the user and user_emails table as a one-to-many relationship (postgresql). It look as follows. router.get('/', function (req, res, next) { db.select('users.id', 'users.name', 'user_emails.address') .from('users') .leftJoin('user_emails', 'users.id', 'user_emails.user_id') .then(users => res.status(200).json(users)) .catch(next) // go to error handler }); However, this will return a new document for each email address. What I want is an array of documents that

Postgres Timestamp

一世执手 提交于 2021-02-06 21:40:12
问题 We are having a debate about the best way to store a timestamp in postgres. Currently all time stamps are stored as +00 and we have a timezone associated with each client. We look up the timezone and convert the time that something happened which increases complexity as we need to do more joins and a more complex query. Another method is connecting to Postgres and setting the timezone of the connection and it changes all the times to be that timezone. My problem with this is that in ANZ there