Re: [GENERAL] Overlapping time ranges constraints in 8.4

2012-08-27 Thread EXT-Rothermel, Peter M
I thought that this was going to be tricky. Perhaps I could use rules to populate a shadow table that is like a INNER JOIN of the two tables. This would consolidate the Boolean on the separate table into the same table that holds the time ranges. In version 8.4 I would still need to use explic

[GENERAL] Overlapping time ranges constraints in 8.4

2012-08-24 Thread EXT-Rothermel, Peter M
I have a temporal data question that may be much easier to handle in version 9.x but I am stuck on version 8.4. One table has a time range that is implemented as start_time and end_time columns of type TIMESTAMP with Timezone. A second table has information that is needed to determine if there i

Re: [GENERAL] Using DEFAULT as a parameter value with PQexecPrepare()

2012-04-06 Thread EXT-Rothermel, Peter M
I simplified my example somewhat. I usually have six of these "optional" parameters. The number of prepared statements would be too many for this approach. I will follow your advice in the cases where I just one or two of the "optional" parameters. Looks like I will need to dynamically build my

[GENERAL] Using DEFAULT as a parameter value with PQexecPrepare()

2012-04-05 Thread EXT-Rothermel, Peter M
I am currently dynamically building a SQL command in my C code like that executes SQL statement like: INSERT INTO t (c1,c2,c3,c4,c5) VALUES ('abc', 1, DEFAULT, 9, 3); I execute the command using PQexec() of libpq. The application logic determines when to use the default values for several

[GENERAL] serial data type usage

2008-11-06 Thread EXT-Rothermel, Peter M
I have a table where I would like the primary key to be generated during the insert. Here is a simplified example: CREATE TABLE employee_type { tname varchar(10) PRIMARY KEY, id_prefix char(1) ; ... } tname | id_prefix --+-- worker | W manager | M exec

[GENERAL] Savepoints and SELECT FOR UPDATE in 8.2

2008-08-01 Thread EXT-Rothermel, Peter M
I have a client application that needs: SELECT a set of records from a table and lock them for potential updates. for each record make some updates to this record and some other records in other tables call some call a function that does some application logic that does not access the da

[GENERAL] Declaring constants in SQL

2008-07-30 Thread EXT-Rothermel, Peter M
Let's say I have a table foo with a column color where the color column is defined as an integer but in my application space is an enumeration: Table "public.foo" Column |Type | Modifiers ---+-