CrudVision - Lisa Seelye

August 6, 2007

I think this guy has it right

Filed under: blog — Lisa Seelye @ 22:53

It’s fairly obvious that 5 tight knit people who know their shit will work better as a unit than 20 people who may perhaps not be up to level of an “expert” (to use the linked blog’s lingo). Who doesn’t dream of working exclusively with the rails core team? ;-)

Link to post

Postgres “gotcha”

Filed under: postgres, snippet — Lisa Seelye @ 08:45

In my evedb.info efforts I need a quick way to expire old market orders. The CSV has a duration column that is an integer number of days. Postgres allows its users to typecast between various data types in SQL so there doesn't need to be a SELECT duration FROM ... ; (in code) to_delete = Time.now + duration.days ; DELETE FROM ... WHERE duration < to_delete;

It just so happens that the form for casting an integer to do math with a timestamp is a bit funky. An integer may not be directly added to a timestamp. The magic is:

SQL:
  1. DELETE
  2. FROM foo
  3. WHERE now()> (created_on + CAST( (duration || ' days') AS INTERVAL));

The || ' days' I don't understand just yet but it works!

Powered by WordPress