postgresql

How to update turbogears application production database.

Hi, I am having a postgres production database in production (which contains a lot of Data). now I need to modify the model of the tg-app to add couple of new tables to the database. How do i do this? I am using sqlAlchemy. ...

How do I set a ODBC .DSN file to allow it to access any database in Postgresql ?

Hello I'm writing an MFC App to automatically configure Postgresql with ODBC for use by another app. The idea being that the user runs the app and it automatically creates the database and the tables within it. My problem is that when I set up the File DSN it seems to require the name of the database it will access. This appears in the ...

Which is the Best database for Rails application?

My doubt is the following: I will start to developing a Rails application that will accesss a lot of RSS feeds or crawl sites for data (most news). It will be something like Google News but with a different approach, so I'll store a lot of news (or news summaries), classify them in different categories and use ranking and recommending t...

PostgreSQL or MS SQL Server?

I'm considering using PostgreSQL with a .Net web app. Basically 3 reasons: Mature Geo Queries Small footprint + Linux Price I'm wondering a bit about tools though, SQL Server Profiler and query plans and performance monitors have been helpful. How is this world with Postgres? Some other things I should consider? Edit: Will most like...

Single database tool to access different database types?

I’d like a visual database tool that will allow me to access multiple database types from the same program. I’m looking for anything that supports Mysql, PostgreSQL, and Derby. Anything else it supports is a bonus. ...

debugging postgresql trigger

I have this Trigger in Postgresql that I can't just get to work (does nothing). For understanding, there's how I defined it: CREATE TABLE documents ( ... modification_time timestamp with time zone DEFAULT now() ); CREATE FUNCTION documents_update_mod_time() RETURNS trigger AS $$ begin new.modification_time := now(); ...

Are inline queries a bad idea?

I have a table containing the runtimes for generators on different sites, and I want to select the most recent entry for each site. Each generator is run once or twice a week. I have a query that will do this, but I wonder if it's the best option. I can't help thinking that using WHERE x IN (SELECT ...) is lazy and not the best way to...

Howto check for existing aggregate functions in Postgres?

In Postgresql you can create additional Aggregate Functions with CREATE AGGREGATE name(...); But this gives an error if the aggregate already exists inside the database, so how can I check if a Aggregate already exists in the Postgres Database? ...

How do I force Postgres to use a particular index?

How do I force Postgres to use an index when it would otherwise insist on doing a sequential scan? ...

.NET/Mono Database Access—Easy column access?

I am not sure if I am missing something grotesquely obvious or what, but I can't seem to figure out how to efficiently access tables in a relational database. I am using PostgreSQL for the database server (and Npgsql for its access) and C# with Mono 2.0. Say I have the table created by the following CREATE TABLE and INSERT statements. ...

How do I get the MIN() of two fields in Postgres?

Let's say I have a table like this: name | score_a | score_b -----+---------+-------- Joe | 100 | 24 Sam | 96 | 438 Bob | 76 | 101 ... | ... | ... I'd like to select the minimum of score_a and score_b. In other words, something like: SELECT name, MIN(score_a, score_b) FROM table The results, of course, wo...

Postgresql Concurrency

Hi, In a project that I'm working, there's a table with a "on update" trigger, that monitors if a boolean column has changed (ex.: false -> true = do some action). But this action can only be done once for a row. There will be multiple clients accessing the database, so I can suppose that eventually, multiple clients will try to update...

Using psql to run an update

Hi there, I've a table with two columns are a unique key together and i cannot change the schema. I'm trying to execute an update using psql in which i change the value of one of the column that are key. The script is similar to the following: BEGIN; UPDATE t1 SET P1='23' where P1='33'; UPDATE t1 SET P1='23' where P1='55'; COMMIT; U...

Good OleDB/ODBC provider for PostgreSQL

Hi! I'm in need of a functional OleDB data provider for PostgreSQL. It should be similar to the ODBC provider for MySQL. See http://dev.mysql.com/downloads/connector/odbc/5.1.html ...

Looking for a Postgresql community

I need to learn about Postgresql. I'm trying to branch an application framework which is dependent on Oracle to use Postgresql. I can easily find communities of Java and JavaScript programmers via the web. Oracle communities a little more difficult, but between OTN and AskTom, I do pretty well. But Postgresql seems few and far between. W...

64-bit Qt and Postgres plugin in Windows

I have a 32-bit Windows/Qt application using Postgres plugin. Recently, I've been intrigued to turn the app into a 64-bit app. So I checked the Qt docs for instructions, built Qt and its libraries into 64-bit successfully. Now the problem is Postgres does not provide libraries for 64-bit Windows! Obviously, the Qt Postgres plugin won't c...

urlencode with only built-in functions

Without using plpgsql, I'm trying to urlencode a given text within a pgsql SELECT statement. The problem with this approach: select regexp_replace('héllo there','([^A-Za-z0-9])','%' || encode(E'\\1','hex'),'g') ...is that the encode function is not passed the regexp parameter, unless there's another way to call functions from within ...

SQL Server functional equivalent to PostgreSQL "in"

In postgres you can do a comparison against multiple items like so: SELECT 'test' IN ('not','in','here'); Which is the same as doing: SELECT ('test' = 'not' OR 'test' = 'in' OR 'test' = 'here'); Is there a functional equivalent for SQL Server ? ...

How to convert an interval like "1 day 01:30:00" into "25:30:00"?

I need to add some intervals and use the result in Excel. Since sum(time.endtime-time.starttime) returns the interval as "1 day 01:30:00" and this format breaks my Excel sheet, I thought it'd be nice to have the output like "25:30:00" but found no way to do it in the PostgreSQL documentation. Can anyone here help me out? ...

Retrieving Comments from a PostGres DB

Hi There... Im running a project on a PostGres database and need to retrieve the comments on columns within the DB to be used as table headings and such. I have seen that there are a couple of built in functions (pg_description and col_description) but i haven't been able to find examples on how to use them and playing around with them ...