postgresql

Django TemplateSyntaxError: current transaction is aborted, what does this exception mean? Does postgresql 8.4 work fine with django?

The full text of the error is: TemplateSyntaxError at / Caught an exception while rendering: current transaction is aborted, commands ignored until end of transaction block I've recently reinstalled all the software on my computer. The code used to work no problem before. It also still works no problem on a friend's comp...

Using hibernate tools to reverse engineer pojos from Postgres

Hi - I am trying to reverse engineer pojos (using hibernate tools plugin v3.2.4x in eclipse 3.4.2) from a database that I have created in Postgres but my tables are being ignored. It works if I specify 'public' as the value for the 'hibernate.default_schema' property in my hibernate.cfg.xml file but if I try to specify a different schema...

JPA inheritance using PostgreSQL

I'm using Seam and trying to organize inheritence among several entities using JPA. A Person entity should be a parent, User and Partner entities ought to be children. The chosen strategy of inheritance is SINGLE_TABLE. The Person entity is as follows: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn( ...

Django DateTime field to generate timestamp fields withOUT timezone

I am working on a Django application where I need all the postgres represented datetime fields to be saved in UTC (as they should). When I'm creating models with DateTime fields they database representation is generated as "timestamp with time zone". Although I can manually alter the tables to remove the timezone from the fields, I was ...

Recreating Postgres COPY directly in Python?

I have a block of data, currently as a list of n-tuples but the format is pretty flexible, that I'd like to append to a Postgres table - in this case, each n-tuple corresponds to a row in the DB. What I had been doing up to this point is writing these all to a CSV file and then using postgres' COPY to bulk load all of this into the data...

JPA and PostqreSQL: long string persistence

Can anybody tell me how to persist long text using JPA (I use PostgreSQL)? Here's the way I defined a very long string in my class: @Lob private String body; However, this produces a field of type charactervarying(255) in the database. Furthermore, I've tried to use @Column annotation: @Column(columnDefinition="TEXT") private Stri...

Django and multiple databases

My current Django setup uses MySQL as the main database to store models. Now for my project I need to connect to a remote PostgreSQL database and retrieve data from it. Is it possible to do this by using built-in Django and Python features or I will need to use library such as Psycopg2? It would be great for me, if I will be able to use...

ERROR: syntax error at or near "OVER"

Hi, I'm new to the SQL language and PostgreSQL. I was getting familiar with the language and was following a PostgreSQL tutorial until I got stuck at a chapter about Window Functions (link text. I created the exact same table 'empsalary' as shown in the example: wtouw=# SELECT * FROM empsalary; depname | empno | salary -----------...

Checking if a postgresql table exists under python (and probably Psycopg2 )

Hello By using the Psycopg2 of Python library, how can I determine if a table exists, getting a true or false boolean. ...

How does one specify a parameter as an array of a copied type?

I have a function that I am using as a sproc. For the parameters, I have one which is the primary key of a record in a particular table. I would like to modify this function so that it takes an array of such keys but I am struggling to find any material that specifies how this is achieved (or whether it is even possible). CREATE OR RE...

Execute sql query with Elixir

I'm using Elixir in a project that connects to a postgres database. I want to run the following query on the database I'm connected to, but I'm not sure how to do it as I'm rather new to Elixir and SQLAlchemy. Anyone know how? VACUUM FULL ANALYZE table Update The error is: "UnboundExecutionError: Could not locate a bind configured on ...

Postgres Error (Getting PLJava set up)

I have been struggling with a problem trying to get PLJava to work on PostgreSQL on RHEL. Here is what I have (based off of this: PL/Java README) .cshrc setenv JAVA_HOME /opt/jdk1.6.0_17/ setenv LD_LIBRARY_PATH ${JAVA_HOME}/jre/lib/i386 setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${JAVA_HOME}/jre/lib/i386/client setenv LD_LIBRARY_PATH ...

Is there a free tool to convert mysql dump to postgres

Hi! I am trying to move my site from mysql to postgres, I don't know how to do it. Already dumped my mysql database with compatible option. But it's impossible to import the data directly. I wonder if there is a free tool, with GUI to do it I already tried several perl scripts but they appears to be buggy (no one helped) :( ...

Generate DDL programmatically on Postgresql

Hi, How can I generate the DDL of a table programmatically on Postgresql? Is there a system query or command to do it? Googling the issue returned no pointers. ...

How to get aggregates without using a nested sql query

I am writing a custom report from an Avamar (Postgresql) database which contains backup job history. My task is to display jobs that failed last night (based on status_code), and include that client's success ratio (jobs succeeded/total jobs run) over the past 30 days on the same line. So the overall select just picks up clients that f...

Separating record returned from function in postgres

I've got a function that returns two parameters as an anonymous composite type via output parameters. I can access the individual columns with a query like this: # select * from guess_user('Joe','Bloggs'); confidence | matchid ------------+--------- 0.142857 | 1121 Now I want to combine the output from this function with some...

Recommendation needed: Rails, Postgres and fuzzy full text search

I have Rails app with a Postgres backend. I need to add full text search which would allow fuzzy searches based on Levenshtein distance or other similar metrics. Add the fact that the lexer/stemmer has to work with non-English words (it would be ok to just switch language-dependent features off when lexing, to not mess with the target l...

Unbuffered queries using Postgres+PHP?

Is there a way to execute unbuffered queries against PostgresSQL from PHP, or at least limit the size of the local buffer that a driver uses? ...

Help installing mysql and postgres gems via Bundler

I'm an experienced developer, but a complete Rails newb. I'm trying to install an existing app that uses the Bundler gem to encapsulate and control the application environment and, after about 3 days of fighting with it, I can't seem to get the environment put together. The bundler Gemfile specifies the use of both mysql and postgres bec...

Using Postgresql as middle layer. Need opinion.

Hi all, I need some opinions. I'm going to develop a POS and inventory software for a friend. This is a one man small scale project so I want to make the architecture as simple as possible. I'm using Winform to develop the GUI (web interface doesn't make sense for POS software). For the database, I am using Postgresql. The program wil...