Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Michael Paquier
On Wed, Jul 2, 2014 at 3:27 PM, Arup Rakshit wrote: > Here is my try : > > staging::=> select to_char(created_at,'DD/MM') || '/' || > to_char(now(),'') as when from users; > when > > 24/02/2014 > 28/02/2014 > 02/03/2014 > 01/03/2014 > 04/03/2014 > 02/03/2014 > 06/03/2

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Arup Rakshit
Here is my try : > > >staging::=> select  to_char(created_at,'DD/MM') || '/' || >to_char(now(),'') as when from users; >    when     > > 24/02/2014 > 28/02/2014 > 02/03/2014 > 01/03/2014 > 04/03/2014 > 02/03/2014 > 06/03/2014 > 07/05/2014 > 02/06/2014 > 06/06/2014 > 20/02/2014 > 

Re: [GENERAL] Very high latency, low bandwidth replication

2014-07-02 Thread Stuart Bishop
On 30 June 2014 15:05, Bob Jolliffe wrote: > What are people's thoughts about a more optimal solution? I would like to > use a more incremental approach to replication. This does not have to be a > "live" replication .. asynchronously triggering once every 24 hours is > sufficient. Also there

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Adrian Klaver
On 07/02/2014 12:48 AM, Arup Rakshit wrote: What is the data at your disposal when trying to select the current year? If it is a timestamp, simply use date_part: =# select date_part('year', now()); date_part --- 2014 (1 row) -- Michael It is *datetime*. Now my users are c

[GENERAL] Question About Roles

2014-07-02 Thread Rich Shepard
My highest priority has just changed to developing a multiuser database application. The backend is postgres, of course, and everything else will be written in Python, SQLAlchemy, and wxPython. This application is at least one order of magnitude more complicated/sophisticated than any I have de

Re: [GENERAL] Question About Roles

2014-07-02 Thread Adrian Klaver
On 07/02/2014 06:17 AM, Rich Shepard wrote: -- Set user roles CREATE ROLE admin LOGIN; CREATE ROLE executive; CREATE ROLE manager; CREATE ROLE technician; and my question is what do I need to do so when a user is added to the system the local administrator and the group specified during the cr

Re: [GENERAL] Question About Roles

2014-07-02 Thread Tom Lane
Rich Shepard writes: > ... my question is what do I need to do so when a user is added to the > system the local administrator and the group specified during the createuser > process, she or he can be granted that group's privileges? I might be misunderstanding, but I think you're looking for GRA

Re: [GENERAL] Question About Roles [ANSWERED]

2014-07-02 Thread Rich Shepard
On Wed, 2 Jul 2014, Tom Lane wrote: I might be misunderstanding, but I think you're looking for GRANT/REVOKE: GRANT rolename TO newuser; tom, You correctly understand my question. That's the syntax I need and did not see. Thank you, Rich -- Sent via pgsql-general mailing list (pgsql-g

Re: [GENERAL] Question About Roles

2014-07-02 Thread David G Johnston
Tom Lane-2 wrote > Rich Shepard < > rshepard@ > > writes: >> ... my question is what do I need to do so when a user is added to the >> system the local administrator and the group specified during the >> createuser >> process, she or he can be granted that group's privileges? > > I might be misu

[GENERAL] Re: How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread David G Johnston
Adrian Klaver-4 wrote > On 07/02/2014 12:48 AM, Arup Rakshit wrote: >> > >> >> What is the data at your disposal when trying to select the current >> year? If it is a timestamp, simply use date_part: >> =# select date_part('year', now()); >> date_part >> >> --- >>2014 >> >> (1 ro

Re: [GENERAL] Question About Roles

2014-07-02 Thread Adrian Klaver
On 07/02/2014 06:17 AM, Rich Shepard wrote: Or, is that automatic if the role is included in the Users table? To follow up on my previous post. If you have your own user table, having a user in that table with the same name as one of the Postgres role does not mean they pick up the Postgres

Re: [GENERAL] Question About Roles

2014-07-02 Thread Rich Shepard
On Wed, 2 Jul 2014, David G Johnston wrote: or if you want to do it as part of creating a new user: CREATE ROLE new_management_user [other stuff here] IN ROLE management; http://www.postgresql.org/docs/9.2/interactive/sql-createrole.html David, I'll have to think deeply about what this is

Re: [GENERAL] Question About Roles

2014-07-02 Thread Rich Shepard
On Wed, 2 Jul 2014, Adrian Klaver wrote: To follow up on my previous post. If you have your own user table, having a user in that table with the same name as one of the Postgres role does not mean they pick up the Postgres role permissions. Adrian, OK. Now I see the issue. What I have c

Re: [GENERAL] Question About Roles

2014-07-02 Thread David G Johnston
Rich Shepard wrote > On Wed, 2 Jul 2014, David G Johnston wrote: > >> or if you want to do it as part of creating a new user: >> >> CREATE ROLE new_management_user >> [other stuff here] >> IN ROLE management; >> >> http://www.postgresql.org/docs/9.2/interactive/sql-createrole.html > > David, > >

Re: [GENERAL] Question About Roles

2014-07-02 Thread Gregory Haase
On Wed, Jul 2, 2014 at 7:50 AM, Rich Shepard wrote: > On Wed, 2 Jul 2014, David G Johnston wrote: > > or if you want to do it as part of creating a new user: >> >> CREATE ROLE new_management_user >> [other stuff here] >> IN ROLE management; >> >> http://www.postgresql.org/docs/9.2/interactive/sq

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Steve Crawford
On 07/01/2014 11:27 PM, Arup Rakshit wrote: Here is my try : staging::=> select to_char(created_at,'DD/MM') || '/' || to_char(now(),'') as when from users; when 24/02/2014 ... 20/02/2014 (15 rows) Can the same be done using any other clever trick ? No tricks are spr

Re: [GENERAL] Migration error " invalid byte sequence for encoding "UTF8": 0xff " from mysql 5.5 to postgresql 9.1

2014-07-02 Thread sunpeng
I‘v changed cmd (in win8) to encoding utf8 through chcp 65001, but error still occurs. And i use the following cmd to dump mysql data: mysql> select Picture from personpicture where id = 'F2931306D1EE44ca82394CD3BC2404D4' into outfile "d:\\1.txt" ; I got the ansi file, and use Ultraedit to see fir

Re: [GENERAL] Question About Roles

2014-07-02 Thread Adrian Klaver
On 07/02/2014 07:50 AM, Rich Shepard wrote: On Wed, 2 Jul 2014, David G Johnston wrote: or if you want to do it as part of creating a new user: CREATE ROLE new_management_user [other stuff here] IN ROLE management; http://www.postgresql.org/docs/9.2/interactive/sql-createrole.html David,

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Arup Rakshit
On Wednesday, July 02, 2014 08:42:43 AM Steve Crawford wrote: > On 07/01/2014 11:27 PM, Arup Rakshit wrote: > > Here is my try : > > > > staging::=> select to_char(created_at,'DD/MM') || '/' || > > to_char(now(),'') as when from users; > > > > when > > > > > > > > 24/02/2

Re: [GENERAL] Question About Roles

2014-07-02 Thread Rich Shepard
On Wed, 2 Jul 2014, David G Johnston wrote: Its the exact same outcome Tom provided, just via a different mechanism... You want to assign all permissions to the standard group-roles and then have new users inherit the appropriate permissions via their membership in the appropriate group-role.

[GENERAL] Not able to understand how to write group by

2014-07-02 Thread Arup Rakshit
Hi, I am working on web development project. There I am using this awesome DB. Let me tell you first the schema that I am having associated the problem. I am having a table *users* - which has many fields. Out of them, the one I need here is *gender*. This column can have value "f"/"m"/"n". I

Re: [GENERAL] Question About Roles

2014-07-02 Thread Rich Shepard
On Wed, 2 Jul 2014, Gregory Haase wrote: If it made you feel better, remember that CREATE USER is an alias for CREATE ROLE that includes LOGIN by default. Greg, Yes, I read that in the docs. So if you simply swap one word in your command, the context becomes a little more clear for what y

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread jared
you have: GROUP BY users.gender, measures.option instead try: GROUP BY users On Wed, Jul 2, 2014 at 12:55 PM, Arup Rakshit wrote: > Hi, > > I am working on web development project. There I am using this awesome DB. > Let > me tell you first the schema that I am having associated the problem. >

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread Arup Rakshit
On Wednesday, July 02, 2014 02:38:36 PM jared wrote: > you have: > GROUP BY users.gender, measures.option > > instead try: > GROUP BY users > > *group by* on full table(*users*). I am away from our production DB. Could you tell me how this little change will solve the whole problem and help me

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread jared
On Wed, Jul 2, 2014 at 1:44 PM, Arup Rakshit wrote: > > *group by* on full table(*users*). I am away from our production DB. Could > you > tell me how this little change will solve the whole problem and help me to > get > the data as per the format I am looking for. > Arup, I meant: GROUP BY use

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread John R Pierce
On 7/2/2014 10:44 AM, Arup Rakshit wrote: *group by* on full table(*users*). I am away from our production DB. Could you tell me how this little change will solve the whole problem and help me to get the data as per the format I am looking for. I believe he meant group by users.gender

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread Arup Rakshit
On Wednesday, July 02, 2014 02:49:54 PM you wrote: > On Wed, Jul 2, 2014 at 1:44 PM, Arup Rakshit > > wrote: > > *group by* on full table(*users*). I am away from our production DB. Could > > you > > tell me how this little change will solve the whole problem and help me to > > get > > the data a

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread Steve Crawford
On 07/02/2014 09:55 AM, Arup Rakshit wrote: SELECT users.gender,count(*) as participant,avg(daily_action_answers.value) as value FROM "users" INNER JOIN "daily_action_answers" ON "daily_action_answers"."user_id" = "users"."id" INNER JOIN "measures" ON "measures"."id" = "daily_action_answers"."mea

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread David G Johnston
Steve Crawford wrote > On 07/02/2014 09:55 AM, Arup Rakshit wrote: >> SELECT users.gender,count(*) as >> participant,avg(daily_action_answers.value) as >> value >> FROM "users" INNER JOIN "daily_action_answers" ON >> "daily_action_answers"."user_id" = "users"."id" >> INNER JOIN "measures" ON "measu

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread Arup Rakshit
On Wednesday, July 02, 2014 12:28:04 PM David G Johnston wrote: > Steve Crawford wrote > > > Are you sure this is what you want? > > Since there are two columns you will have to either use a CASE or a select > to facilitate calculating the values for each of the columns. > > SELECT gender, ans

Re: [GENERAL] Two-way encryption

2014-07-02 Thread Kevin Grittner
Toby Corkindale wrote: > From: "Patrick Simcoe" >> I have a question regarding two-way encryption data for specific columns. >> >> Does anyone have a technique or recommendation for two-way encryption which >> somehow obfuscates the decrypt key so that it isn't easily retrievable from >> the dat

Re: [GENERAL] how to create multiple databases running in different dirs

2014-07-02 Thread frank ernest
> how would an instance of your program know what to connect to, or which > previous instance its 'predecessor' was ? > normally, you have ONE database for a given set of applications, and all > the applications share the same database tables and such. That's the problem, is there some way to t

Re: [GENERAL] how to create multiple databases running in different dirs

2014-07-02 Thread John W Higgins
Afternoon Frank, I believe what you might wish to look at is a single database with a set of schemas[1] which would separate your data in a logical way. You could have a single connection url and then each individual connection could create a schema (or reuse if you wish), set the search path (fir

Re: [GENERAL] how to create multiple databases running in different dirs

2014-07-02 Thread John R Pierce
> how would an instance of your program know what to connect to, or which > previous instance its 'predecessor' was ? > normally, you have ONE database for a given set of applications, and all > the applications share the same database tables and such. That's the problem, is there some way to t

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread Arup Rakshit
On Wednesday, July 02, 2014 12:28:04 PM David G Johnston wrote: > Steve Crawford wrote > > > Are you sure this is what you want? > > Since there are two columns you will have to either use a CASE or a select > to facilitate calculating the values for each of the columns. > > SELECT gender, ans

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread David G Johnston
afonit wrote >> genderparticipants answer1_avg answer2_avg >> n 3 12 3 >> m 5 4 12 >> f 71523 Are you sure t

[GENERAL] Windows releases - Bundle OpenSSL includes and .libs in the installer?

2014-07-02 Thread Craig Ringer
Hi I've just noticed that the EDB-produced installer for Pg omits a number of components required to build things that're fully compatible with libpq if they also use some of the same libs as libpq, like libintl, openssl, etc. The specific case of interest to me is psqlODBC, which I've been doing

Re: [GENERAL] Not able to understand how to write group by

2014-07-02 Thread Alban Hertroys
On 02 Jul 2014, at 18:55, Arup Rakshit wrote: > Hi, > > I am working on web development project. There I am using this awesome DB. > Let > me tell you first the schema that I am having associated the problem. > > I am having a table *users* - which has many fields. Out of them, the one I > n