Re: [SQL] compile postgres with visual studio 2010

2011-07-20 Thread Kevin Crain
The documentation only mentions Visual Studio 2005 and Visual Studio 2008, but I see no reason why it shouldn't work. Check out the requirements listed in the documentation: http://www.postgresql.org/docs/9.0/interactive/install-windows-full.html On Wed, Jul 20, 2011 at 3:55 AM, Sofer, Yuval wro

Re: [SQL] Max column number.

2011-07-13 Thread Kevin Crain
Have you tried changing the block size? http://wiki.postgresql.org/wiki/FAQ#What_is_the_maximum_size_for_a_row.2C_a_table.2C_and_a_database.3F On Wed, Jul 13, 2011 at 11:03 AM, Miguel Angel Conte wrote: > I have the metadata in the same csv. > > On Wed, Jul 13, 2011 at 3:00 PM, Ke

Re: [SQL] Max column number.

2011-07-13 Thread Kevin Crain
Is there any room for improvement in the data types? On Wed, Jul 13, 2011 at 11:03 AM, Miguel Angel Conte wrote: > I have the metadata in the same csv. > > On Wed, Jul 13, 2011 at 3:00 PM, Kevin Crain wrote: >> >> How are you determining the data types for these columns?

Re: [SQL] Max column number.

2011-07-13 Thread Kevin Crain
nce if the > information is all into a same row. > > On Wed, Jul 13, 2011 at 3:28 AM, Kevin Crain wrote: >> >> I still can't imagine why you'd ever need this...could you explain >> what this does? I'm just curious now >> >> On Tue, Jul 12

Re: [SQL] Max column number.

2011-07-12 Thread Kevin Crain
I still can't imagine why you'd ever need this...could you explain what this does? I'm just curious now On Tue, Jul 12, 2011 at 10:55 PM, Kevin Crain wrote: > This is an unfortunate situation, you shouldn't be required to do > this, the people generating your re

Re: [SQL] combining strings to make a query

2011-07-12 Thread Kevin Crain
You can do full-text search in postgres now using ts_vectors. I'd recommend going that route. Doing like comparisons is not a good idea if you don't know the first part of the string you are searching forIt appears to be much faster from my experience to search for ab% than it is to search fo

Re: [SQL] Max column number.

2011-07-12 Thread Kevin Crain
This is an unfortunate situation, you shouldn't be required to do this, the people generating your requirements need to be more informed.  I would make damn sure you notify the stakeholders in this project that the data model is screwed and needs a redesign.  I agree that you should split this tabl

Re: [SQL] interesting sequence

2011-07-12 Thread Kevin Crain
> On 2011-07-06, Kevin Crain wrote: >> That's why you need to do this inside a function.  Basically just make >> an insert function for the table and have it calculate the count and >> do the insert in one transaction. > > you will still get duplicates, so include code

Re: [SQL] interesting sequence

2011-07-05 Thread Kevin Crain
rote: >> >> On Tuesday, July 05, 2011 01:11:11 pm Kevin Crain wrote: >> > You don't need a loop there.  Assuming your order id field is of type >> > varchar you can just build the first part of your string and then do a >> > count to get the last part usi

Re: [SQL] interesting sequence

2011-07-05 Thread Kevin Crain
My previous reply was intended for John. On Tue, Jul 5, 2011 at 1:11 PM, Kevin Crain wrote: > You don't need a loop there.  Assuming your order id field is of type > varchar you can just build the first part of your string and then do a > count to get the last part using a L

Re: [SQL] interesting sequence

2011-07-05 Thread Kevin Crain
You don't need a loop there. Assuming your order id field is of type varchar you can just build the first part of your string and then do a count to get the last part using a LIKE comparison: select count(id_order) + 1 from sometable WHERE id_order LIKE 'O-20110704 -%'; If you do this inside a

Re: [SQL] need help with some aggregation magic

2011-06-09 Thread Kevin Crain
s)))-a.ts) AS duration from log a order by user_id, project_id, ts) AS foo group by user_id, project_id, ts) AS day_set group by user_id, project_id, date_trunc order by user_id, project_id, date_trunc; -Kevin Crain On Thu, Jun 9, 2011 at 6:43 AM, Andreas wrote: > hi, > I have a lo

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread Kevin Crain
My approach would be to add a column for LAST_TS and place a trigger on insert that populates this new column. Then you have something you can put in your WHERE clause to test on. On Fri, Jun 3, 2011 at 12:52 PM, wrote: > I have a table that, at a minimum, has ID and timestamp columns.  Records

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread Kevin Crain
Why is (0,20:10) listed in your expected results when there is a (0,20:08)? On Fri, Jun 3, 2011 at 12:52 PM, wrote: > I have a table that, at a minimum, has ID and timestamp columns.  Records > are inserted into with random IDs and timestamps.  Duplicate IDs are allowed. > > I want to select re

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread Kevin Crain
It looks like maybe he is trying to fetch records that either have no previous entries or have another record with a timestamp 5 minutes before them at the time they are inserted... On Sat, Jun 4, 2011 at 4:45 AM, Jasen Betts wrote: > On 2011-06-03, lists-pg...@useunix.net wrote: >> >> ID    TS

Re: [SQL] selecting records X minutes apart

2011-06-03 Thread Kevin Crain
Will you be using a full timestamp with that or are you only concerned about hours and minutes? If you want a full timestamp do you care about the seconds? For example, do you want to be able to do this for '2011-06-01 23:59:04' and '2011-06-02 00:04:04'? On Fri, Jun 3, 2011 at 12:52 PM, wrote:

Re: [SQL] Re: Order of evaluation in triggers for checks on inherited table partitions

2011-05-31 Thread Kevin Crain
ordinary update, hence the error. In order to get this to work I had to add a trigger for each child table as well to call my update function trigger. --Kevin Crain On Tue, May 31, 2011 at 6:40 AM, Kevin Crain wrote: > Can procedural languages be used in rules?  I didn't see any examples

Re: [SQL] Re: Order of evaluation in triggers for checks on inherited table partitions

2011-05-31 Thread Kevin Crain
Can procedural languages be used in rules? I didn't see any examples in the documentation that suggested something like this could be done using rules. --Kevin Crain On Mon, May 30, 2011 at 2:21 AM, Jasen Betts wrote: > On 2011-05-27, Kevin Crain wrote: >> I am trying to creat

[SQL] Order of evaluation in triggers for checks on inherited table partitions

2011-05-27 Thread Kevin Crain
I am trying to create a trigger on updates to a table that is partitioned. The child tables are partitioned by month and include checks on a timestamp field. I want the trigger on the updates to call a function that replaces the update entirely. In order to do this my trigger deletes the record