[GENERAL] database design best pratice help

2013-01-28 Thread Jose Soares
Hi all, I have a question about database design best pratice. In my db I have about one hundred tables like this: code description To avoid to have a so great number of similar tables in the db I wonder if it is a good idea to unify all these tables in one big table like this: id code table_

Re: [GENERAL] database design best pratice help

2013-01-28 Thread Thomas Kellerer
I'll answer with the same things I did on the Oracle list :) code description To avoid to have a so great number of similar tables in the db I wonder if it is a good idea to unify all these tables in one big table like this: id code table_ name description The advantages are: 1. only one

Re: [GENERAL] database design best pratice help

2013-01-28 Thread Albe Laurenz
Jose Soares wrote: I have a question about database design best pratice. In my db I have about one hundred tables like this: code description To avoid to have a so great number of similar tables in the db I wonder if it is a good idea to unify all these tables in one big table like

[GENERAL] Rules on views - Changes from 8.4 to 9.1 ?

2013-01-28 Thread Leif Jensen
Hello. We have a system that has been running using PostgreSQL 8.4. We have now upgraded to PostgreSQL 9.1. The system has several rules on views and now most of these does not seem to work anymore. It is rather simple rules with mainly only 1 replacement sql (update for 'on update' and

[GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Bob Futrelle
Do the declare statements and insert all have to be done in one statement execute()? That is, what is the scope of variables I declare? I see a variety of syntax examples, some for older versions? I'm using pg 9.2.2, so what are the rules/syntax for declaring and using variables? Use case: I

[GENERAL] finding if a period is multiples of a given interval

2013-01-28 Thread c k
Hi, I have two variables in pl/pgsql function. p_fromdate and p_todate I have another variable which represents intervals like day, month, quarter etc. p_interval as smallint, to hold values like 1,2,3, which are substituted for intervals as '1 day', '1 month - 1 day', '3 months - 1 day'

Re: [GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Dave Cramer
Bob, Can you provide a snippet of code so I can understand what you mean by declare ? Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On Mon, Jan 28, 2013 at 7:11 AM, Bob Futrelle bob.futre...@gmail.comwrote: Do the declare statements and insert all have to be done in one

Re: [GENERAL] Can LC_TIME affect timestamp input?

2013-01-28 Thread Paul Jones
- Original Message - From: Jasen Betts ja...@xnet.co.nz To: pgsql-general@postgresql.org Cc: Sent: Saturday, January 26, 2013 9:00 PM Subject: Re: [GENERAL] Can LC_TIME affect timestamp input? On 2013-01-25, Paul Jones p...@cmicdo.com wrote: Is it possible for LC_TIME locale

[GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread Stephen Cook
Hello! I have convinced a client to use PostgreSQL instead of MySQL (hooray), which means it falls on me to install and configure it. I'm planning on doing this from the command line (I have SSH access). I have installed and configured PostgreSQL on Windows, FreeBSD, and a few Linux

Re: [GENERAL] finding if a period is multiples of a given interval

2013-01-28 Thread Adrian Klaver
On 01/28/2013 05:24 AM, c k wrote: Hi, I have two variables in pl/pgsql function. p_fromdate and p_todate I have another variable which represents intervals like day, month, quarter etc. p_interval as smallint, to hold values like 1,2,3, which are substituted for intervals as '1 day',

Re: [GENERAL] Rules on views - Changes from 8.4 to 9.1 ?

2013-01-28 Thread Adrian Klaver
On 01/28/2013 02:19 AM, Leif Jensen wrote: Hello. We have a system that has been running using PostgreSQL 8.4. We have now upgraded to PostgreSQL 9.1. The system has several rules on views and now most of these does not seem to work anymore. It is rather simple rules with mainly only

Re: [GENERAL] finding if a period is multiples of a given interval

2013-01-28 Thread c k
I know that. I have to check the period (dates entered by user) must be correct and must be perfectly divisible by the interval given. This is a pre-check for the interest calculation. If user enters '01/04/2010' and '15/05/2010' as the dates, and interval as 'month' then, there are 15 days left

Re: [GENERAL] finding if a period is multiples of a given interval

2013-01-28 Thread Adrian Klaver
On 01/28/2013 07:17 AM, c k wrote: I know that. I have to check the period (dates entered by user) must be correct and must be perfectly divisible by the interval given. This is a pre-check for the interest calculation. If user enters '01/04/2010' and '15/05/2010' as the dates, and interval as

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread Steve Atkins
On Jan 28, 2013, at 6:45 AM, Stephen Cook scli...@gmail.com wrote: Hello! I have convinced a client to use PostgreSQL instead of MySQL (hooray), which means it falls on me to install and configure it. I'm planning on doing this from the command line (I have SSH access). I have

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread Tom Lane
Steve Atkins st...@blighty.com writes: OS X doesn't have readline installed, it has libedit. Libedit is poor compared to readline, and the OS X installed version of libedit was, for years, hideously broken such that tab completion would cause SEGVs. It might have been fixed in the latest

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread Stephen Cook
On 1/28/2013 11:15 AM, Steve Atkins wrote: You're not planning on using this in production, I hope? OS X is a very solid desktop OS, but it's server variant is packed full of weird and plain broken behaviour. Ouch. These are the servers they have and use, I don't really get a say in that.

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread Steve Atkins
On Jan 28, 2013, at 8:47 AM, Stephen Cook scli...@gmail.com wrote: On 1/28/2013 11:15 AM, Steve Atkins wrote: You're not planning on using this in production, I hope? OS X is a very solid desktop OS, but it's server variant is packed full of weird and plain broken behaviour. Ouch.

Re: [GENERAL] Best approach for query with optional constraints

2013-01-28 Thread Kevin Grittner
Jon Smark jon.sm...@yahoo.com wrote: Here's the problem: I want to retrieve a list of bugs (possibly) matching certain constraints.  One possible constraint is a user ID: if given, only those bugs reported by the user will be returned.  Another constraint is a set of tags: only those bugs

Re: [GENERAL] main.log file not being updated

2013-01-28 Thread Anson Abraham
no cluster, just 2 different independent/isolated DB servers. As for location of logs, yes, it's the correct one, b/c when logrotate (through system), initiated I can see the other log files gzipped. The install was done through ,what I believe, apt-get. I guess it might require a bouncing of

Re: [GENERAL] database design best pratice help

2013-01-28 Thread Kevin Grittner
Jose Soares jose.soa...@sferacarta.com wrote: In my db I have about one hundred tables like this: code description To avoid to have a so great number of similar tables in the db I wonder if it is a good idea to unify all these tables in one big table like this: id code table_ name

Re: [GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Bob Futrelle
Here's a small, but complete code example - Bob package us.tsos.dbs.pg; import java.sql.*; /** * This is an effort to get a computed value from a Java function * (or data object) included properly in the VALUES entries. * So, how can I declare an SQL variable and set its value to some Java

Re: [GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Edson Richter
You have two options: st.execute(insert into hello values ('bKey', +f1()+)); or PreparedStatement st = db.prepareStatement(insert into hello values ('bKey', ?)); st.setInteger(1, f1()); where 1 is the first parameter, 2 is the second parameter, and so on. Regards, Edson Richter Em

Re: [GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Dave Cramer
Bob, Ok, have a look at PreparedStatement Essentially the same PreparedStatement pstmt= db.prepareStatement(insert into hello values ?) pstmt.setInt(1,intVar) pstmt.execute() Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On Mon, Jan 28, 2013 at 1:50 PM, Bob Futrelle

Re: [GENERAL] database design best pratice help

2013-01-28 Thread Bob Futrelle
Yes. The general rules are: Many normalized tables. OK. Denormalizing simply to reduce the number of tables. Not OK. - Bob On Mon, Jan 28, 2013 at 1:47 PM, Kevin Grittner kgri...@ymail.com wrote: Jose Soares jose.soa...@sferacarta.com wrote: In my db I have about one hundred tables

Re: [GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Bob Futrelle
Thanks to Edson and Dave for lightning responses. I'm confident that your answers will do the job. I'll follow up on the advice AFTER I get my coffee ;-) I'm really focused on the NLP content of my research, but I need a DB infrastructure to do it right. (Not a bunch of files as in ancient

Re: [GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Edson Richter
I would recommend the reading of the excellent The Java Tutorial, that has a very well explained section about JDBC: http://docs.oracle.com/javase/tutorial/jdbc/index.html and the chapter about PreparedStatements: http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html Regards,

Re: [GENERAL] main.log file not being updated

2013-01-28 Thread Adrian Klaver
On 01/28/2013 10:38 AM, Anson Abraham wrote: no cluster, just 2 different independent/isolated DB servers. On the same machine or different machines? As for location of logs, yes, it's the correct one, b/c when logrotate (through system), initiated I can see the other log files gzipped. The

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread Wolfgang Keller
I have installed and configured PostgreSQL on Windows, FreeBSD, and a few Linux flavors, but never OSX. I have the basic directions (http://www.enterprisedb.com/resources-community/pginst-guide) and found a couple of articles / blogs, but really I'm not an Apple guy so I don't want to miss

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread François Beausoleil
Le 2013-01-28 à 14:47, Wolfgang Keller a écrit : I have installed and configured PostgreSQL on Windows, FreeBSD, and a few Linux flavors, but never OSX. I have the basic directions (http://www.enterprisedb.com/resources-community/pginst-guide) and found a couple of articles / blogs, but

[GENERAL] update performance of degenerate index

2013-01-28 Thread Scott Ribe
I'm seeing occasional simple-looking updates take way longer than I think they should, and if my theory about it is correct, it's not actually a problem. Consider this index, intended to provide extremely quick access to a small number of items from a much larger table: create index

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread David Salisbury
On 1/28/13 1:05 PM, François Beausoleil wrote: I would stay away from MacPorts. Gotta agree on that one. The last time I have been working with PostgreSQL on MacOS X, I used the installer from http://www.postgresqlformac.com/ There's also a different approach, that I've never

Re: [GENERAL] update performance of degenerate index

2013-01-28 Thread Filip Rembiałkowski
Just some questions, which might be helpful. What size is this index? What is underlying table size? Is ANALYZE running regularly (autovacuum or manual)? What are stats for exported_when column (pg_stats)? Did you look at pg_locks during this lengthy update? Do you have many concurrent statements

Re: [GENERAL] finding if a period is multiples of a given interval

2013-01-28 Thread Steve Crawford
On 01/28/2013 05:24 AM, c k wrote: Hi, I have two variables in pl/pgsql function. p_fromdate and p_todate I have another variable which represents intervals like day, month, quarter etc. p_interval as smallint, to hold values like 1,2,3, which are substituted for intervals as '1 day', '1

Re: [GENERAL] JDBC - Need to declare variables for values in insert statement

2013-01-28 Thread Bob Futrelle
I had read 'through' the JDBC material, but now reading more deeply with more insight. The API is useful too. Anyhoo, PreparedStatement works like a charm, viz., PreparedStatement pstmt= db.prepareStatement(insert into hello values ('cKey', ?)); pstmt.setInt(1,intVar); pstmt.execute(); This

Re: [pgpool-general: 1315] Re: [GENERAL] Database connections seemingly hanging

2013-01-28 Thread Fredrik . HuitfeldtMadsen
Hello Mr. Ishii, we have attempted to create a selfcontained testcase, but have been unsuccessful so far. We understand how pgpool acquires locks in theory, but it seems that what we are seeing is different. We have summarized our findings here: http://pastebin.com/9f6gjxLA It seems that

[GENERAL] JDBC connection test with SSL on PG 9.2.1 server

2013-01-28 Thread Hari Babu
While testing PostgreSQL JDBC java client to connect to the PG 9.2.1 database server using SSL. we got the following behavior. The test steps as below: url = jdbc:postgresql:// + 10.145.98.227 + ':' + 8707 + '/' + POSTGRES; Properties props = new Properties();