postgresql-9.1

Spring Security JDBC authentication default schema error when using PostgreSQL

…衆ロ難τιáo~ 提交于 2019-12-03 05:55:16
Is it really impossible to use default schema for Spring Security with PostgreSQL, because the part "varchar_ignorecase" does not exist can't be replaced? I'm just testing the default settings: auth.jdbcAuthentication() .dataSource(dataSource) .withDefaultSchema(); And below is the error: Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.servlet.Filter org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain() throws java.lang.Exception] threw exception; nested exception is org

Aggregate values over a range of hours, every hour

大憨熊 提交于 2019-12-03 05:44:38
I have a PostgreSQL 9.1 database with a table containing a timestamp and a measuring value '2012-10-25 01:00' 2 '2012-10-25 02:00' 5 '2012-10-25 03:00' 12 '2012-10-25 04:00' 7 '2012-10-25 05:00' 1 ... ... I need to average the value over a range of 8 hours, every hour. In other words, I need the average of 1h-8h, 2h-9h, 3h-10h etc. I have no idea how to proceed for such a query. I have looked everywhere but have also no clue what functionalities to look for. The closes I find are hourly/daily averages or block-averages (e.g. 1h-8h, 9h-16h etc.). But in these cases, the timestamp is simply

List constraints for all tables with different owners in PostgreSQL

爷,独闯天下 提交于 2019-12-03 05:38:51
Do I have to be owner of relation to access constraint related data in information schema? I've tested the following and it seems that I have to be the owner. create schema rights_test; create table rights_test.t1 (id int primary key); create table rights_test.t2 (id int references rights_test.t1(id)); select tc.constraint_name, tc.constraint_schema || '.' || tc.table_name || '.' || kcu.column_name as physical_full_name, tc.constraint_schema, tc.table_name, kcu.column_name, ccu.table_name as foreign_table_name, ccu.column_name as foreign_column_name, tc.constraint_type from information_schema

Cannot connect to Postgres running on VM from host machine using MD5 method

感情迁移 提交于 2019-12-03 05:15:51
问题 I have a VM set up with Vagrant that has Postgres running on it (on port 5432), forwarded to port 8280 on the host machine. I have set the password for the default user and I can connect locally just fine. I have been trying to set up access from the host machine over port 8280, and I have been unable to get it working with 'MD5' as the trust method. I have set up postgresql.conf to listen on all addresses: # postgresql.conf listen_addresses = '*' and I have configured pg_hab.conf as follows:

postgres, ubuntu how to restart service on startup? get stuck on clustering after instance reboot

随声附和 提交于 2019-12-03 04:41:14
问题 I have a Postgres db 9.1 running on AWS EC2 , with ubuntu 12.04 . I messed a lot with the instance (i.e installed all kinds of postgres X.X before i settled on 9.1). Now after a month working on that db, I discovered that if I restart my instance postgres doesn't load correctly, its status says "Running clusters". this will last forever until I sudo service postgresql restart from terminal, and then it works again. How do I add this line, to ubuntu startup so that each time it loads, it will

Strange PostgreSQL “value too long for type character varying(500)”

守給你的承諾、 提交于 2019-12-03 03:32:35
问题 I have a Postgres schema which looks like: The problem is that whenever I save text longer than 500 characters in the description column I get the error: value too long for type character varying(500) In the documentation for Postgres it says type text can have unlimited characters. I'm using postgresql-9.1. This table has been generated using Django 1.4 and the field type in the model is TextField, if that helps explain the problem further. Any ideas as why this is happening and what I can

extract week number from date postgres

断了今生、忘了曾经 提交于 2019-12-03 02:04:46
I would like to extract the week number as: 2015-52 from a date formatted as: 2015-12-27 How can I perform this in postgres? my weeks are calculated from monday to sunday. To get the year and the week in a single character value, use to_char() select to_char(current_date, 'IYYY-IW'); IW returns the year and the week number as defined in the ISO standard and IYYY returns the corresponding year (which might be the previous year). If you need the year and the week number as numbers, use extract select extract('isoyear' from current_date) as year, extract('week' from current_date) as week; You can

Postgres ENUM data type or CHECK CONSTRAINT?

隐身守侯 提交于 2019-12-03 01:52:03
问题 I have been migrating a MySQL db to Pg (9.1), and have been emulating MySQL ENUM data types by creating a new data type in Pg, and then using that as the column definition. My question -- could I, and would it be better to, use a CHECK CONSTRAINT instead? The MySQL ENUM types are implemented to enforce specific values entries in the rows. Could that be done with a CHECK CONSTRAINT? and, if yes, would it be better (or worse)? 回答1: Based on the comments and answers here, and some rudimentary

Select sum of an array column in PostgreSQL

风格不统一 提交于 2019-12-03 01:33:29
If I have the following table: Table "users" Column | Type | Modifiers ---------------+------------------+----------- id | integer | not null default nextval('users_id_seq'::regclass) monthly_usage | real[] | Where monthly_usage is an array of 12 numbers, i.e. {1.2, 1.3, 6.2, 0.9,...} How can I select the sum of that column? Something along the lines of: SELECT id, sum(monthly_usage) as total_usage from users; Which obviously doesn't work. Dmitry Seleznev SELECT id, (SELECT SUM(s) FROM UNNEST(monthly_usage) s) as total_usage from users; This generalization and reformatting Dmitry 's answer

Integration of postgreSQL on WAMP

柔情痞子 提交于 2019-12-02 23:57:44
I have just installed the postgreSQL on windows 7. I am trying to integrate postgreSQL with WAMP server. For this i have done the following changes in httpd.conf and php.ini file 1 LoadModule c:/path to libpq.dll in httpd.conf and then 2 extension=php_mod_pgsql.dll , extension=php_pgsql.dll -- enable(reemove ;) in php.ini If I do the above changes the localhost does not work. If I do the second changes the localhost work but does not load the libpq.dll . I checked the pgsql by php script by this <?php echo extension_loaded('pgsql') ? 'yes':'no'; ?> The script shows "yes", but apache is not