postgresql

Move data from one database to other with different data structure.

How to move data from suppose mysql database to postgres database? Scenario: Two similar application. A user wants to switch from one application to other. But he had maintained certain data information in his previous appilaction which uses mysql database.When he switch his appliaction he has to move his data from his old application t...

Error:SQL Problems: ERROR :operator does not exists:date>= character varying

i am using iReport 3.6.0 with postgresql database ,for date type parameter its giving the following error when writing query "Error:SQL Problems: ERROR :operator does not exists:date>= character varying" please help ...

psycopg2 disconnects from server

I've been tackling this for a while. I setup a completely new machine. I've installed a fresh copy of postgresql and all my other dependencies. Basically, I get these database disconnections at random times. I can perform identical requests and either it works or it doesn't. Very nondeterministic in outward appearance. Watching logs at P...

Hibernate is rounding my double ?

Hi, I've got a double which I'm trying to save to a postgres numeric column. The value I'm trying to save is 151.33160591125488, and I've verified that this is in fact the argument being received by Hibernates internals pre-insert. However the value in the database post insert is 151.331605911255, ie it's been rounded to 12dp. I know...

Entity Framework ObjectContext -> raw SQL calls to native DBMS

I have an app using the ADO.NET entity framework (the VS2008 version, not the newer, cooler one) and I need to be able to make a call down to the underlying DBMS (it's postgres) in order to call some SQL that Entity Framework doesn't support. Is there a way to go from an Entity Framework ObjectContext to something that will let me exec...

CakePHP putting quotes around function name in WHERE clause

I'm using various functions from the earthdistance module in PostgreSQL, one of those being ll_to_earth. Given a latitude/longitude combination, I'm trying to retrieve the nearest point from my database via CakePHP 1.2.5 Stable. // set dummy data $latitude = 30.4393696; $longitude = -97.6200043; // create a simple bounding box in the...

Postgresql compiled from source WAL file compatibility with ubuntu package

Hi all, Pardon my ignorance. Is it possible to use the WAL files generated by Postgresql compiled from source (version 8.3.5) by an Ubuntu Postgresql package (8.3.4)? Thanks in advance. ...

Postgresql compiled from source versus ubuntu package

Hi all, What are the advantages/disadvantages of using postgresql compiled from source compared to the ubuntu postgresql package? Which of the two are recommended to be used on a live production environment? Thanks in advance. ...

sort postgres table data in php through array

I have a postgres database with a table called workorders. In it is a column called date_out where the date is recorded like 2009-09-23. I want to sort this table data in a php page based on a users date range, ie, sort the table by date begin 2009-09-01 end 2009-09-31. Its for an accounts package I am creating for my company. Is there a...

Can I retrieve an aggregate column via the Containable behavior?

Is it possible for CakePHP's Containable behavior to request an aggregate column value during a find()? For example, in model Item containing numeric columns quarks and cogs: $this->Item->contain('quarks + cogs AS total'); ...

JdbcTemplate batch update in postgresql - date loses time?

I am inserting a list of object with java.util.date in format YYYY-MM-DDThh:mm:ssTZD (2008-09-26T14:34:59+02:00). SQL: INSERT INTO cdate (key,valuedate,user_id) VALUES(?,?,?) BatchPreparedStatementSetter bpss = new MetaJdbc().setMetaBatchPreparedStatement( list, userId); getJdbcTemplate().batchUpdate(sql,bpss); Date is...

PostgreSQL SELECT the last order per customer per date range

In PostgreSQL: I have a Table that has 3 columns: CustomerNum, OrderNum, OrderDate. There may(or may not) be many orders for each customer per date range. What I am needing is the last OrderNum for each Customer that lies in the date range that is supplied. What I have been doing is getting a ResultSet of the customers and querying ...

Making Postgres accessible in Firefox by Psql

How can you make Postgres accessible in Firefox, in installing MediaWiki? I get the error "No database connection" because Firefox cannot have a database connection. I can have database connection in terminal by the user, masi. This suggests me that Firefox is not acting like a masi, so it cannot have the access. Error Warning: pg_ve...

How to create and read a sequence in Hibernate?

Hello, I need to use a sequence to get a unique value. The production code uses postgres but I would like to access it via Hibernate so that I can test this with HSQLDB. How can I create and read a sequence in Hibernate? ...

SQL Server to Postgres

I am doing some research on migrating away from Microsoft sql server to postgresql and am looking for the best tools to get the job done. Specifically looking for a tool similar to MySQL Migration Toolkit, I did a test migration of our databases to MySQL and had each one under way in under an hour. It looks like pgAdmin will do most of...

Moving away from MS SQL Server to open source RDBMS

So I'm an MSSQL guy and I have been for a while because it's what I've always used in my workplaces. So when I create a new project I'm usually inclined to just grab a copy of SQL Express and start working from there. However, I've been asked to work on a new project but for various reasons, we can't use SQL Express edition and the lice...

Can I have a postgres plpgsql function return variable-column records?

I want to create a postgres function that builds the set of columns it returns on-the-fly; in short, it should take in a list of keys, build one column per-key, and return a record consisting of whatever that set of columns was. Briefly, here's the code: CREATE OR REPLACE FUNCTION reports.get_activities_for_report() RETURNS int[] AS $F...

Package Level Constants in Oracle to Postgres Conversion

I am looking at converting an application from Oracle to Postrges that has all the business logic in the database. Currently there is a very large package that has about 200 public constant variables. Postgres does not support package level variables so I am debating how to convert it. I see two possibilities but need some opinions about...

What units does the PostgreSQL "earthdistance" module use?

I'm guessing that the units it uses is meters (m), but it doesn't seem clear from the documentation I've found. Is this correct? If so, just to verify, in order to convert between miles/meters, I presume these functions should do the trick: public static function mi2m($mi) { // miles to meters return $mi * 1609.344; } public stat...

Python to Postgres interface with real prepared statements?

I've been trying to find a postgres interface for python 2.x that supports real prepared statements, but can't seem to find anything. I don't want one that just escapes quotes in the params you pass in and then interpolates them into the query before executing it. Anyone have any suggestions? ...