postgresql

How can I improve this SQL query?

I'm checking for existing of a row in in_fmd, and the ISBN I look up can be the ISBN parameter, or another ISBN in a cross-number table that may or may not have a row. select count(*) from in_fmd i where (description='GN') and ( i.isbn in ( select bwi_isbn from bw_isbn where orig_isbn = ? union all select...

PL/Ruby equivalent in MySQL

PL/Ruby is a loadable procedural language for Postgres that lets you use Ruby to write user defined functions for the database. Anyone know of an equivalent way of writing user defined functions for MySQL in Ruby? ...

PostgreSQL UNIX domain sockets vs TCP sockets

I wonder if the UNIX domain socket connections with postgresql are faster then tcp connections from localhost in high concurrency rate and if it does, by how much? ...

Database (and ORM) choice for an small-medium size .NET Application

Hi I was hoping to get some advice from the panel. I have a requirement to develop a .NET-based application whose data requirements are, in the future, likely to exceed the 4 gig limit of SQL 2005 Express Edition. There may be other customers of the same application in the future witwh a requirement to use a specific DB platform (such...

How do I turn SQL logging on in Postgres 8.2?

I've got the following settings in my postgres conf: log_destination = 'stderr' redirect_stderr = on log_directory = '/tmp/psqlog' log_statement = 'all' And yet no logs are logged. What am I missing here? There is reference on the internet to a variable called "logging_collector", but when I try and set that, postgres dies on startu...

Subselect in pgSQL

I'm trying to do a subselect in pgsql aka postgresql and the example I found doesn't work: SELECT id FROM (SELECT * FROM table); ...

Setting the comment of a column to that of another column in Postgresql

Suppose I create a table in Postgresql with a comment on a column: create table t1 ( c1 varchar(10) ); comment on column t1.c1 is 'foo'; Some time later, I decide to add another column: alter table t1 add column c2 varchar(20); I want to look up the comment contents of the first column, and associate with the new column: select...

"No suitable driver" problem with Hibernate3, PostgreSQL 8.3 and Java 5

Hi. Does anybody know what's going on here: I run hibernate 3.2.6 against a PostgreSQL 8.3 (installed via fink) database on my Mac OS X. The setup works fine when I use Java 6 and the JDBC 4 driver (postgresql-8.3-603.jdbc4). However, I need this stuff to work with Java 5 and (hence) JDBC 3 (postgresql-8.3-603.jdbc3). When I change the...

Mysterious Mongrel Rails crash

Running Mongrel 1.1.5 on Rails 2.1.2 using PostgreSQL 8.3 via ruby-pg 0.7.9 on OS X 10.4 server... Added restful_authentication and exception_notification, the latter of which appears to be doing me no good when Mongrel simply dies with "Illegal instruction" every time I select /RESOURCE_NAME/new. Doesn't matter what resource. In deve...

Is it better to use tables instead of arrays field type in PostgreSql when arrays do not exceed 50 elements?

Or better said: When to use array as a field data type in a table? Which solution provides better search results? ...

What are the advantages and disadvantages of using a 'Partial Index'?

PostgreSQL allows the creation of 'Partial Indexes' which are basically indexes with conditional predicates. http://www.postgresql.org/docs/8.2/static/indexes-partial.html While testing, I found that they are performing very well for a case where the query is accessing only certain 12 rows in a table with 120k rows. But before we dep...

How do I ALTER the POSITION of a COLUMN in a Postgresql database?

How do I ALTER the POSITION of a COLUMN in a Postgresql database? I've tried the following, but I was unsuccessful: ALTER TABLE person ALTER COLUMN dob POSITION 37; ...

JDBC: Can I share a connection in a multithreading app, and enjoy nice transactions?

It seems like the classical way to handle transactions with JDBC is to set auto-commit to false. This creates a new transaction, and each call to commit marks the beginning the next transactions. On multithreading app, I understand that it is common practice to open a new connection for each thread. I am writing a RMI based multi-client...

Test automation with postgresql connected application

Hello there, I want to automate tests on my web application, and it uses postgresql. Does anyone know how define a restore point on a postgresql database and restore to an earlier state? I heard something about point in time recovery, but i dont if this is what i need. Thanks in advance ...

Operator does not exist: interval > integer

A query working on Postgresql 7.4 but not on Postgresql 8.3 with same database. Query: SELECT * FROM login_session WHERE (now()-modified) > timeout; Get error ERROR: operator does not exist: interval > integer LINE 1: ...ELECT * FROM login_session WHERE (now()-modified) > timeout ... ...

Tool to find out why an SQL select does not return any data.

Is there a tool which tells you (or gives you a hint) why a particular select statement dose not return any rows given the current data in your database. eg if you had the following 4 table join select * from a, b, c, d where a.b_id = b.id and b.c_id = c.id and c.d_id = d.id If there were rows which satisfied the conditions a.b_id ...

Exception Handling in classes and Code Behind with C#

Hi... I'm a little bit stuck with a asp.net project that i'm doing! I have got a class that is called from the code behind and many of its function have no return type ie, being void. How does one do exception handling then??? Also, if the function within the class does have a return type of, for instance, a dataset how would one then r...

Querying data from different tables

I am using a query like this on my postgres database, SELECT TableA.id FROM TableA , TableB WHERE TableA.id = 100; Each TableA.id is unique (its an autoincrement), I am gettting more than 1 result. Am i missing something in here? ...

Update function in postgres help

Hi there... I have a question regarding an update function I created... CREATE OR REPLACE FUNCTION rm_category_update(icompany bpchar, iraw_mat_cat_code bpchar, iraw_mat_cat_desc bpchar) RETURNS character AS $BODY$ DECLARE loc_result CHAR(50); BEGIN UPDATE rm_category SET raw_mat_cat_code = iraw_mat_cat_code, r...

Using ruby to convert unsigned integers stored as signed back to the original value

A C-program is placing what it considers to be 64-bit unsigned integers into a column in a Postgres database that is typed as int8. To Postgres, int8 is always 'signed int8' (no such thing to it as 'unsigned int8'). So the Ruby program I have shows numbers retrieved from Postgres in the upper half of that space as negative. What is the ...