Re: [GENERAL] Replicate over pgbouncer?

2015-05-21 Thread Joseph Kregloh
You will want to setup your replication user to connect to PostgreSQL directly. Going through pgBouncer is asking for trouble. -Joseph Kregloh

Re: [GENERAL] Allowing postgresql to accept 0xff syntax for data types that it makes sense for?

2015-05-21 Thread Tom Lane
Bill Moran wmo...@potentialtech.com writes: My other question: is there a specific reason why PostgreSQL doesn't support this syntax, aside from nobody has bothered to add such support? Because I'm considering writing a patch to Postgres and submitting it, but I'm not going to go down that

Re: [GENERAL] date with month and year

2015-05-21 Thread Daniel Torres
Sorry, forgot to told you what I'm trying, I have climate data and want to obtain mean temperature and total precipitation and that sort of things per month and year. Think date_trunc is a good solution, but any other advice would be very welcome. (I need to read more about time zones, I'm new at

Re: [GENERAL] Replicate over pgbouncer?

2015-05-21 Thread Andomar
I'm doubtful. Why do you think you need such a capability? For simplicity. If I can replicate through pgbouncer, I'll need only one open port on the machine. Postgres would just listen on localhost. If not, I'll have to make Postgres listen on an interface on a different port. -Andomar

Re: [GENERAL] Replicate over pgbouncer?

2015-05-21 Thread Peter Eisentraut
On 5/21/15 12:12 PM, Andomar wrote: Hi, Today I installed pgbouncer. I added a second installation as a hot standby. Before starting the standby, I configured recovery.conf to connect to pgbouncer. This results in an error message: Pooler Error: Unsupported startup parameter:

Re: [GENERAL] Replicate over pgbouncer?

2015-05-21 Thread Melvin Davidson
Since you did not specify your O/S and PostgreSQL version, I'll just point you to the documentation for 9.1. http://www.postgresql.org/docs/9.1/interactive/different-replication-solutions.html It looks very much to me like you are trying to use a hammer to turn a screw. pg_bouncer is not

Re: [GENERAL] Allowing postgresql to accept 0xff syntax for data types that it makes sense for?

2015-05-21 Thread Brown, Joseph E.
Unsubscribe pgsql-general -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Tom Lane Sent: Thursday, May 21, 2015 1:57 PM To: Bill Moran Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Allowing postgresql to

Re: [GENERAL] date with month and year

2015-05-21 Thread Steve Crawford
On 05/21/2015 10:45 AM, Paul Jungwirth wrote: You really shouldn't use WITHOUT TIME ZONE. I'd like to know more about this. Can you say why? Start by reading about the date and time data types with special attention to section 8.5.3:

[GENERAL] Allowing postgresql to accept 0xff syntax for data types that it makes sense for?

2015-05-21 Thread Bill Moran
I'm working on a project converting a bunch of code from another database system to PostgreSQL. One of the issues is that the previous system accepted integers and binary data in the same hex format as C ... i.e. 0xff I understand that the proper way to handle this in postgres is x'ff', but the

Re: [GENERAL] About COPY command (and probably file fdw too)

2015-05-21 Thread Nicolas Paris
Hi, To me this would be great. Why not the ability to restrict lines too COPY stafflist (userid, username, staffid) FROM 'myfile.txt' WITH (FORMAT text, DELIMITER E'\t', COLUMNS (1, 2, 7), LINES(2:1000,2000:3000), ENCODING 'windows-1250') = subset of full data. 2015-05-21 22:25 GMT+02:00

Re: [GENERAL] Unit tests and foreign key constraints

2015-05-21 Thread Dave Owens
I know some say your unit tests shouldn't touch the DB but the more full stack tests I have, the better I sleep at night :-)) Unit tests really should be about testing individual bits of logic. Does a single method do the desired thing, and not the undesired thing... Ideally, your data

Re: [GENERAL] About COPY command (and probably file fdw too)

2015-05-21 Thread Melvin Davidson
I understand what you want with regards to skipping columns in input, but rather than wait to see if that feature is added to a future version of PostgreSQL, probably the best work around is to 1. CREATE an intermediate table with all columns in the input text file. 2. COPY into the intermediate

Re: [GENERAL] Unit tests and foreign key constraints

2015-05-21 Thread Martijn van Oosterhout
On Thu, May 21, 2015 at 01:33:46PM -0700, Dave Owens wrote: I know some say your unit tests shouldn't touch the DB but the more full stack tests I have, the better I sleep at night :-)) Unit tests really should be about testing individual bits of logic. Does a single method do the

Re: [GENERAL] Unit tests and foreign key constraints

2015-05-21 Thread Martijn van Oosterhout
On Thu, May 21, 2015 at 12:39:01PM -0700, Andy Chambers wrote: Hey All, I've started trying to use foreign key constraints in my schema but it seems to make it more difficult to write unit tests that touch the database because each test now requires more setup data to satisfy the foreign key

Re: [GENERAL] date with month and year

2015-05-21 Thread Thomas Kellerer
Brian Dunavant wrote on 21.05.2015 21:51: It's probably worth noting that both the Ruby 'best practice' AND Postgres have a failure case when dealing with future dates precisely because they are storing the data as UTC with a time zone. This is one case where storing the data WITHOUT TIME ZONE

Re: [GENERAL] date with month and year

2015-05-21 Thread Karsten Hilbert
Anyway, I agree that you have to store the time zone *somewhere*, and I suppose that's the reason Joshua remarked that you really shouldn't use WITHOUT TIME ZONE. And often a time has one perspective that is canonical or preferred, e.g. the time zone of the user who created the object.

Re: [GENERAL] date with month and year

2015-05-21 Thread Brian Dunavant
On Thu, May 21, 2015 at 5:27 PM, Thomas Kellerer spam_ea...@gmx.net wrote: Postgres does not store the time zone. When storing a timestamp with time zone, it is normalized to UTC based on the timezone of the client. When you retrieve it, it is adjusted to the time zone of the client. Sorry,

Re: [GENERAL] Unit tests and foreign key constraints

2015-05-21 Thread Andy Chambers
On Thu, May 21, 2015 at 1:34 PM, Martijn van Oosterhout klep...@svana.org wrote: On Thu, May 21, 2015 at 12:39:01PM -0700, Andy Chambers wrote: Hey All, I've started trying to use foreign key constraints in my schema but it seems to make it more difficult to write unit tests that touch

Re: [GENERAL] About COPY command (and probably file fdw too)

2015-05-21 Thread Stefan Stefanov
Hi, Maybe I need to clarify a little. The suggested option “[SKIP] COLUMNS ” would contain columns' positions in the file so that only some of the columns in a text file would be read into a table. Example: copy the first, second and seventh columns form myfile.txt into table stafflist.

Re: [GENERAL] date with month and year

2015-05-21 Thread Karsten Hilbert
It's probably worth noting that both the Ruby 'best practice' AND Postgres have a failure case when dealing with future dates precisely because they are storing the data as UTC with a time zone. This is one case where storing the data WITHOUT TIME ZONE would actually save your bacon. From

[GENERAL] Strange replication problem - segment restored from archive but still requested from master

2015-05-21 Thread Piotr Gasidło
Got strange problem. Unable to repeat, but got logs. Simple master-slave using streaming replication. Master is running. Slave is down. Segment 00044C4D0090 was successfully archived and send from master to slave. Now I've started slave, and: ay 21 21:23:37 d8 postgres[50645]: [3-1]

Re: [GENERAL] About COPY command (and probably file fdw too)

2015-05-21 Thread David G. Johnston
On Thu, May 21, 2015 at 1:33 PM, Nicolas Paris nipari...@gmail.com wrote: Hi, To me this would be great. Why not the ability to restrict lines too COPY stafflist (userid, username, staffid) FROM 'myfile.txt' WITH (FORMAT text, DELIMITER E'\t', COLUMNS (1, 2, 7), LINES(2:1000,2000:3000),

Re: [GENERAL] date with month and year

2015-05-21 Thread Paul Jungwirth
what you've said above is incorrect. All WITH TIME ZONE does is tell PostgreSQL to apply timezone conversions during various operations. The stored data is represented as an epoch without any concept of the source data's timezone representation. Oh, very interesting! Thank you for pointing

Re: [GENERAL] date with month and year

2015-05-21 Thread Paul Jungwirth
Hi Steve, Thanks for such a thorough response! I agree that time is a lot trickier and trappier than one might expect, so it's good to learn how others grapple with it. Your original question had to do with month/year. Just to clarify, that was Daniel's original question, but you're

Re: [GENERAL] date with month and year

2015-05-21 Thread David G. Johnston
On Thu, May 21, 2015 at 2:10 PM, Paul Jungwirth p...@illuminatedcomputing.com wrote: Anyway, I agree that you have to store the time zone *somewhere*, and I suppose that's the reason Joshua remarked that you really shouldn't use WITHOUT TIME ZONE. And often a time has one perspective that is

[GENERAL] RLS policy issue

2015-05-21 Thread Ted Toth
I'm work on understanding and implementing RLS. Since I work on systems using SELinux (MLS policy) I'm using the sepgsql module that I've modified slightly i.e. I've added a function named sepgsql_check_row_perm that I'm using in the policy for example I have a 'reports' table that looks like:

Re: [GENERAL] Enum in foreign table: error and correct way to handle.

2015-05-21 Thread Ian Barwick
On 21/05/15 04:23, Peter Swartz wrote: I'm creating a foreign table (foo_table) in database_a. foo_table lives in database_b.foo_table has an enum (bar_type) as one of its columns. Because this enum is in database_b, the creation of the foreign table fails in database_a. database_a doesn't

Re: [GENERAL] RLS policy issue

2015-05-21 Thread Stephen Frost
Ted, * Ted Toth (txt...@gmail.com) wrote: I'd also expect that the rewrite would have added the POLICY SELECT USING clause to the query but I don't see any indication of that in the details that follow: Just running 'explain' should show the policy. Are you running this as the owner of the

Re: [GENERAL] Strange replication problem - segment restored from archive but still requested from master

2015-05-21 Thread Venkata Balaji N
On Fri, May 22, 2015 at 6:52 AM, Piotr Gasidło qua...@barbara.eu.org wrote: Got strange problem. Unable to repeat, but got logs. Simple master-slave using streaming replication. Master is running. Slave is down. Segment 00044C4D0090 was successfully archived and send from master

Re: [GENERAL] date with month and year

2015-05-21 Thread Adrian Klaver
On 05/21/2015 11:56 AM, Steve Crawford wrote: On 05/21/2015 10:45 AM, Paul Jungwirth wrote: You really shouldn't use WITHOUT TIME ZONE. I'd like to know more about this. Can you say why? Start by reading about the date and time data types with special attention to section 8.5.3:

Re: [GENERAL] Allowing postgresql to accept 0xff syntax for data types that it makes sense for?

2015-05-21 Thread Bill Moran
On Thu, 21 May 2015 13:57:24 -0400 Tom Lane t...@sss.pgh.pa.us wrote: Bill Moran wmo...@potentialtech.com writes: My other question: is there a specific reason why PostgreSQL doesn't support this syntax, aside from nobody has bothered to add such support? Because I'm considering writing a

Re: [GENERAL] date with month and year

2015-05-21 Thread Adrian Klaver
On 05/21/2015 11:02 AM, Daniel Torres wrote: Sorry, forgot to told you what I'm trying, I have climate data and want to obtain mean temperature and total precipitation and that sort of things per month and year. Think date_trunc is a good solution, but any other advice would be very welcome.

Re: [GENERAL] date with month and year

2015-05-21 Thread Alvaro Herrera
Adrian Klaver wrote: SELECT extract ( YEAR FROM school_day ) AS YEAR, Reformatting courtesy of pgFormatter(http://sqlformat.darold.net/). FWIW I think this indenting of FROM inside an extract() call is odd and ugly --- probably just an accident resulting from

Re: [GENERAL] date with month and year

2015-05-21 Thread Adrian Klaver
On 05/21/2015 09:04 PM, Alvaro Herrera wrote: Adrian Klaver wrote: SELECT extract ( YEAR FROM school_day ) AS YEAR, Reformatting courtesy of pgFormatter(http://sqlformat.darold.net/). FWIW I think this indenting of FROM inside an extract() call is odd and ugly

Re: [GENERAL] Strange replication problem - segment restored from archive but still requested from master

2015-05-21 Thread Fujii Masao
On Fri, May 22, 2015 at 5:52 AM, Piotr Gasidło qua...@barbara.eu.org wrote: Got strange problem. Unable to repeat, but got logs. Simple master-slave using streaming replication. Master is running. Slave is down. Segment 00044C4D0090 was successfully archived and send from master

Re: [GENERAL] date with month and year

2015-05-21 Thread Jan de Visser
On May 21, 2015 11:56:52 AM Steve Crawford wrote: The article does also display a couple attitudes that I feel are especially rampant in the web-development community. The first is that web developers shouldn't become educated about the capabilities of a database but rather use the database as

Re: [GENERAL] date with month and year

2015-05-21 Thread Paul Jungwirth
You really shouldn't use WITHOUT TIME ZONE. I'd like to know more about this. Can you say why? Are there any articles you'd recommend? I'm fond of normalizing all times to UTC and only presenting them in a time zone when I know the current perspective. I've written about that approach in a

Re: [GENERAL] date with month and year

2015-05-21 Thread Steve Crawford
On 05/21/2015 10:01 AM, Daniel Torres wrote: I everybody, I'm new in the Postgresql world, and have an easy question: Is it possible to have date type data that only contain month and year?, how can I obtain that from a timestamp (without time zone) column?... Others have offered good tips

Re: [GENERAL] Replicate over pgbouncer?

2015-05-21 Thread Andomar
Since you did not specify your O/S and PostgreSQL version, I'll just point you to the documentation for 9.1. We're using CentOS 6.5 with PostgreSQL 9.4.1. Like the original post mentioned, we use a hot standby for replication. The question is whether we can do the hot standby through

Re: [GENERAL] date with month and year

2015-05-21 Thread Brian Dunavant
It's probably worth noting that both the Ruby 'best practice' AND Postgres have a failure case when dealing with future dates precisely because they are storing the data as UTC with a time zone. This is one case where storing the data WITHOUT TIME ZONE would actually save your bacon. From the

Re: [GENERAL] Allowing postgresql to accept 0xff syntax for data types that it makes sense for?

2015-05-21 Thread Jan de Visser
On May 21, 2015 06:04:37 PM Brown, Joseph E. wrote: Unsubscribe pgsql-general This doesn't work. See the footer of the posts to the mailing list.

[GENERAL] Unit tests and foreign key constraints

2015-05-21 Thread Andy Chambers
Hey All, I've started trying to use foreign key constraints in my schema but it seems to make it more difficult to write unit tests that touch the database because each test now requires more setup data to satisfy the foreign key constraint. (I know some say your unit tests shouldn't touch the DB

[GENERAL] Replicate over pgbouncer?

2015-05-21 Thread Andomar
Hi, Today I installed pgbouncer. I added a second installation as a hot standby. Before starting the standby, I configured recovery.conf to connect to pgbouncer. This results in an error message: Pooler Error: Unsupported startup parameter: replication Is it possible to replicate

Re: [GENERAL] [SQL] extracting PII data and transforming it across table.

2015-05-21 Thread Suresh Raja
On Thu, May 21, 2015 at 11:33 AM, Steve Midgley scie...@misuse.org wrote: I would update the IDs using SQL before dumping if possible. If necessary clone the tables, adjust the IDs and then dump. SQL has better tools than most languages/scripts to adjust values in columns across multiple

Re: [GENERAL] Replicate over pgbouncer?

2015-05-21 Thread David G. Johnston
On Thursday, May 21, 2015, Andomar ando...@aule.net wrote: Hi, Today I installed pgbouncer. I added a second installation as a hot standby. Before starting the standby, I configured recovery.conf to connect to pgbouncer. This results in an error message: Pooler Error: Unsupported

[GENERAL] date with month and year

2015-05-21 Thread Daniel Torres
I everybody, I'm new in the Postgresql world, and have an easy question: Is it possible to have date type data that only contain month and year?, how can I obtain that from a timestamp (without time zone) column? I've made this, but I think the result is a text, not a date select extract (Year

Re: [GENERAL] date with month and year

2015-05-21 Thread John McKown
On Thu, May 21, 2015 at 12:01 PM, Daniel Torres nobeea...@gmail.com wrote: I everybody, I'm new in the Postgresql world, and have an easy question: Is it possible to have date type data that only contain month and year?, how can I obtain that from a timestamp (without time zone) column? I've

[GENERAL] extracting PII data and transforming it across table.

2015-05-21 Thread Suresh Raja
Hi Folks: I'm looking at directions or help in extracting data from production and alter employee id information while extracting. But at the same time maintain referential integrity across tables. Is it possible to dump data to flat file and then run some script to change emp id data on all

Re: [GENERAL] [SQL] extracting PII data and transforming it across table.

2015-05-21 Thread Steve Midgley
I would update the IDs using SQL before dumping if possible. If necessary clone the tables, adjust the IDs and then dump. SQL has better tools than most languages/scripts to adjust values in columns across multiple entities. Plus it should be easier to build some test queries in SQL to validate

Re: [GENERAL] date with month and year

2015-05-21 Thread David G. Johnston
On Thursday, May 21, 2015, Daniel Torres nobeea...@gmail.com wrote: I everybody, I'm new in the Postgresql world, and have an easy question: Is it possible to have date type data that only contain month and year?, how can I obtain that from a timestamp (without time zone) column? I've made

Re: [GENERAL] date with month and year

2015-05-21 Thread Paul Jungwirth
Is it possible to have date type data that only contain month and year?, how can I obtain that from a timestamp (without time zone) column? I think you want date_trunc, which will cut everything down to the first of the month, e.g 2015-01-01, 2015-02-01, etc. The results will still be dates,

Re: [GENERAL] date with month and year

2015-05-21 Thread Joshua D. Drake
On 05/21/2015 10:01 AM, Daniel Torres wrote: I everybody, I'm new in the Postgresql world, and have an easy question: Is it possible to have date type data that only contain month and year?, how can I obtain that from a timestamp (without time zone) column? I've made this, but I think the