postgresql

Right way to create custom pgsql types in django

What is the right way to create custom pgsql types for django application so that each time database is created with syncdb, all custom types are created prior to creating any tables (so that tables can use this type)? I also use django-evolution, but that's not an appropriate solution — it runs after syncdb. I can imagine doing a worka...

How to use Npgsql with TableAdapter in C#

Hi, I have PostgresQL database, and I develop interface application using C# and Npgsql to connect to the database, how can I assign the Npgsql connection to TableAdapter? Thanks, ...

PostgreSQL ODBC driver not showing up in Control Panel (Data Sources)

I installed psqlODBC and when I go to Control Panel -> Data Sources (ODBC) I don't see the Postgres driver installed. I rebooted, still nothing. I then noticed that if I launch this control panel applet from the file c:\WINDOWS\system32\odbccp32.cpl the drivers suddenly appear! This happens on an XP 64 bit machine. I can't really ex...

How do I insert data into a Postgres table using PowerShell or VBScript?

I need to periodically query the event logs on a handful of servers and insert specific events into a Postgres table. I am having trouble figuring out how I can insert data into a table via ODBC using PowerShell and/or VBScript. I'm reasonably familiar with both VBScript and PowerShell generally, and I can craft a SQL UPDATE statement t...

Searching across multiple tables (best practices)

I have property management application consisting of tables: tenants landlords units properties vendors-contacts Basically I want one search field to search them all rather than having to select which category I am searching. Would this be an acceptable solution (technology wise?) Will searching across 5 tables be OK in the long run...

PostgreSQL: Defining a primary key on a large database.

I am planing a database to store lots of text. (blog posts, news articles, etc.) The database needs to have the title, content (50k characters max), date, link and language fields. The same content can't occur on one link. Old content (older then 30 days, for example) will be deleted. Now, the problem is the primary key. I could just se...

Postgres dump: pg_catalog.setval

Does anyone know what pg_catalog.setval does? I just did a dump off a PostgreSQL database and got lots of lines with that in it. Not sure what it's for. ...

Configuration Recommendations for a PostgreSQL Installation

I have a Windows Server 2003 machine which I will be using as a Postgres database server, the machine is a Dual Core 3.0Ghz Xeon with 4 GB ECC Memory and 4 x 120GB 10K RPM SAS Drives, all stripped. I have read that the default Postgres install is configured to run nicely on a 486 with 32MB RAM, and I have read several web pages about co...

Converting MySQL select to Postgresql

Hello, I have this query which works correctly in MySQL. More background on it here. SELECT c.*, SUM(ABS(v.vote)) AS score FROM categories c,items i, votes v WHERE c.id = i.category_id AND i.id = v.voteable_id AND v.created_at > '#{1.week.ago}' GROUP BY c.id ORDER BY score DESC LIMIT 8; I tried running it in Postgresql and it ...

How to release possible Postgres row locks?

I ran an update statement on a large PostgreSQL table through the phpPgAdmin interface. This timed out as it ran for too long. I can now update some rows from that table but not all. Trying to update some rows will hang. Are the rows locked? How can I allow these rows to be updated? ...

Good Mac Client/GUI for Postgresql?

Anyone found one of these? "Sequel Pro" is awesome for MySQL development on Mac, and they say they are working on Postgresql support (see discussion here) but I haven't found anything else in the mean time. pgAdmin III is horrible. ...

Does a varchar field's declared size have any impact in PostgreSQL?

Is VARCHAR(100) any better than VARCHAR(500) from a performance point of view? What about disk usage? Talking about PostgreSQL today, not some database some time in history. ...

Deleted user 'postgres' - oops

I accidentally deleted the user 'postgres' user the #userdel command and no longer have access to the database. What can I do to create a new postgres user and how can I start postgresql again? If I have to re-install postgresql, do I just delete my current postgres setup by removing the /usr/local/postgresql-8.3.6/ directory? NOTE: I...

Propel custom Setter with SQL-specific stuff

Hello stackoverflow gurus I am using Propel 1.2 in a Symfony 1.0 project, with PostgreSQL db. I can use Criteria::CUSTOM in SELECT statements in order to use Postgres functions, like this (fulltext search): `$c = new Criteria(); $c->add(MyTablePeer::FULLTEXT_COLUMN, MyTablePeer::FULLTEXT_COLUMN." @@ to_tsquery('english', 'text to sear...

JPA and PostgreSQL Network Address Types

Is there a standard way to define a JPA entity that has columns with PostgreSQL network address data types? Im using OpenJPA ...

Efficient storage of and access to large XML files

I have a legacy binary file format containing records that we have to convert and serve to other parts of our system as XML. To give a sense of the data sizes, a single file may be up to 50 megs with 50,000 or more records in it. The XML conversion I have to work with blows this particular file up by a factor of 20 to nearly a gig. ...

Slow query with left outer join and is null condition

I've got a simple query (postgresql if that matters) that retrieves all items for some_user excluding the ones she has on her wishlist: select i.* from core_item i left outer join core_item_in_basket b on (i.id=b.item_id and b.user_id=__some_user__) where b.on_wishlist is null; The above query runs in ~50000ms (yep, the number is co...

Trouble with join query

Hello overflowers ;) I'm implementing home brew ACL system in web app and it gives me hard time. I believe this is trivial, just can't get my head around it. I have 3 tables in one to many relationship: resource, perms_group, perms_users where perms_group is a key table while perms_users allowes me to fine tune access per user basis if...

How to use JodaTime with java.sql.Timestamp

I Have a prepared statement INSERT INTO mst(time) VALUES (?); where time is of type Timestamp in a PostgreSQL database. I am inserting a Joda DateTime object, or I should say I am trying to. I can find no way to convert the DateTime ovject into a java.sql.Timestamp. I have read the Joda docs and see no reference to this. Thanks. ...

UPDATE vs INSERT statement performance in PostgreSQL

I am working with a database of a million rows approx.. using python to parse documents and populate the table with terms.. The insert statements work fine but the update statements get extremely time consuming as the table size grows.. It would be great if some can explain this phenomenon and also tell me if there is a faster way to d...