[GENERAL] Constraining overlapping date ranges

2010-12-21 Thread McGehee, Robert
PostgreSQLers, I'm hoping for some help creating a constraint/key on a table such that there are no overlapping ranges of dates for any id. Specifically: Using PostgreSQL 9.0.1, I'm creating a name-value pair table as such this: CREATE TABLE tbl (id INTEGER, start_date DATE, stop_date DATE, va

Re: [GENERAL] Constraining overlapping date ranges

2010-12-22 Thread McGehee, Robert
our suggestion: ... EXCLUDE USING gist (f_point(id) WITH ~=, f_period(start_date, end_date) WITH &&) -Original Message- From: Filip RembiaƂkowski [mailto:filip.rembialkow...@gmail.com] Sent: Wednesday, December 22, 2010 8:28 AM To: McGehee, Robert Cc: pgsql-general@postgresql.org Subject

[GENERAL] Role inheritance and Conflicting Parameter Values

2014-06-23 Thread McGehee, Robert
Hi, I'm trying to set the default statement_timeout parameter for two different groups of users. However, as many of the users inherit from overlapping roles, I wanted to get clarification on how inheritance of parameter values worked when a role inherits from other roles that all have different

[GENERAL] Aggregating over nodes in hierarchical trees

2014-09-10 Thread McGehee, Robert
Hello, I have data in a hierarchical tree structure in one table (tree_tbl) containing the number of students enrolled in a college course. The college course name is stored as a tree giving the college name, department, and course name, and perhaps other descendent nodes such as section name. I

[GENERAL] Carry forward last observation

2013-06-19 Thread McGehee, Robert
Hello, I have a table with dates and stock prices. Some of the prices are NULL because the stock did not trade on that day. In such instances, I'd like to replace the NULL value with the most recent non-NULL value, but I can't find an efficient way to do this. I had thought a clever WINDOW funct

[GENERAL] Smaller data types use same disk space

2012-07-24 Thread McGehee, Robert
Hi, I've created two tables labeled "Big" and "Small" that both store the same 10 million rows of data using 493MB and 487MB of disk space respectively. The difference is that the "Big" table uses data types that take up more space (integer rather than smallint, float rather than real, etc). The

Re: [GENERAL] Smaller data types use same disk space

2012-07-25 Thread McGehee, Robert
configured.) I'm using 100%, but it shouldn't matter as I was giving sizes without the index anyway. SC> Do the tables have OIDs or not? No -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Tuesday, July 24, 2012 10:00 PM To: Adrian Klaver Cc: McGehee, Ro

[GENERAL] Arbitrary and mixed data types in function

2012-02-29 Thread McGehee, Robert
Hello, I'd like to write a generalized function that accepts arguments of all type without producing an error if types do not match across arguments. As an example, I've written a simple function below called 'bound' (below) that returns a value 'x' bounded by the range [lo, hi]. The function w