0
голосов
1ответов
798 просмотров

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 cann...

3
голосов
6ответов
14879 просмотров

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 ...

1
голосов
2ответов
1989 просмотров

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, userI...

1
голосов
1ответов
284 просмотров

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');

0
голосов
3ответов
640 просмотров

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 packag...

1
голосов
3ответов
287 просмотров

Postgresql compiled from source versus ubuntu package

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.

0
голосов
1ответов
81 просмотров

Postgresql compiled from source WAL file compatibility with ubuntu package

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.

2
голосов
1ответов
1127 просмотров

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.620004...

4
голосов
4ответов
8726 просмотров

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 Object...

2
голосов
2ответов
8357 просмотров

Hibernate is rounding my double?

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, ...

13
голосов
4ответов
13985 просмотров

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...

0
голосов
3ответов
5310 просмотров

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

2
голосов
6ответов
2445 просмотров

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 t...

0
голосов
2ответов
222 просмотров

When backing up a postgres database I get prompted for a password

I'm busy backing up my postgres db, I run the following command pg_dump -d data -U postgres -h 127.0.0.1 -CdiOv > data.sql I however have one problem I get asked for the password, if I want to add this into a cron I do not want to get promted for the password. Is there any way to do this wi...

0
голосов
1ответов
2023 просмотров

default values/modifiers in postgres?

I've problem with default modifiers on postgres 8.4. (I think version is its not important) I've debian ubuntu. When Im creating migrations on rails AR: class CreateUserMails < ActiveRecord::Migration def self.up create_table :user_mails do |t| t.string :title, :limit=> 128...

0
голосов
3ответов
380 просмотров

How to create a backup of an POSTGRES DB using bash?

How to create a backup of an POSTGRES DB using bash?

1
голосов
2ответов
2390 просмотров

Introspect postgresql 8.3 to find foreign keys

I'm trying to introspect a postgres 8.3 database to retrieve details of its foreign keys. Imagine I have the following schema: CREATE TABLE "a" ( "id" SERIAL PRIMARY KEY ); CREATE TABLE "b" ( "one" integer, "two" integer, "a_id" integer REFERENCES "a", PRIMARY KEY ("one", "two") ); CREAT...

114
голосов
8ответов
81937 просмотров

PostgreSQL LIKE query performance variations

I have been seeing quite a large variation in response times regarding LIKE queries to a particular table in my database. Sometimes I will get results within 200-400 ms (very acceptable) but other times it might take as much as 30 seconds to return results. I understand that LIKE queries are ver...

33
голосов
10ответов
72668 просмотров

Character with encoding UTF8 has no equivalent in WIN1252

I am getting the following exception: Caused by: org.postgresql.util.PSQLException: ERROR: character 0xefbfbd of encoding "UTF8" has no equivalent in "WIN1252" Is there a way to eradicate such characters, either via SQL or programmatically? (SQL solution should be preferred). I was thinking ...

52
голосов
2ответов
55483 просмотров

How do I import modules or install extensions in Postgres 8.4?

I'm trying to import several modules that come bundled with 8.4.1 postgres, and all the commands to do so (such as contrib.import etc) do not work or cannot be found. Please help me.

12
голосов
5ответов
40742 просмотров

Generate SQL statements with python

I need to generate a list of insert statements (for postgresql) from html files, is there a library available for python to help me properly escape and quote the names/values? in PHP i use PDO to do the escaping and quoting, is there any equivalent library for python? Edit: I need to generate a ...

71
голосов
9ответов
77833 просмотров

List stored functions that reference a table in PostgreSQL

Just a quick and simple question: in PostgreSQL, how do you list the names of all stored functions/stored procedures using a table using just a SELECT statement, if possible? If a simple SELECT is insufficient, I can make do with a stored function. My question, I think, is somewhat similar to th...

1
голосов
2ответов
1080 просмотров

Linking to PostgreSQL and SSL

I'm trying to use libpq, the client library for PostgreSQL in a Cocoa app. First thing, adding the header files: I tried adding the path to the PostgreSQL header files under User Header Search Path on my project's properties and then compile but for some reason XCode can't see them. The solution...

1
голосов
1ответов
751 просмотров

query part of a binary field from sql table

a bit newb question: in my DB I've got a table with a binary field. I'd like to fetch not that whole field in a request, but rather part of it, preferably using ODBC. Is it at all possible? I'm using PostgreSQL 8.3 - in case a solution exists for that specific DBMS. Thanks. Getting data part-by-...

3
голосов
2ответов
3655 просмотров

"LIKE" does not work as expected

In Postgresql 8 why this is ok select * from prod where code like '1%' select * from prod where code like '%1' but this returns 0 rows (there are codes begining/ending with digit 1) select * from prod where code like '1%1' Update That happens in my current instalation: # psql --version p...

1
голосов
2ответов
3215 просмотров

How to run shell script on remote machine from Java?

I'm creating a test which will perform some stress testing of the app which talks to a Postgres database. In order to make it replicable I'd like to recreate the database on every run. Startup method decorated with org.junit.Before annotation will drop the database (if it exists) and restore it f...

19
голосов
6ответов
16535 просмотров

Guides for PostgreSQL query tuning?

I've found a number of resources that talk about tuning the database server, but I haven't found much on the tuning of the individual queries. For instance, in Oracle, I might try adding hints to ignore indexes or to use sort-merge vs. correlated joins, but I can't find much on tuning Postgres o...

2
голосов
5ответов
6862 просмотров

How to speed up LIKE operation in SQL (Postgres preferably)

We have a Postgres database which contains 2 millions entries. We have tried using equality search and it works instantly (SELECT * FROM a WHERE b = "asd") But we would like "LIKE '%asd%'" operation to be fast too. How do we do that?

16
голосов
3ответов
11927 просмотров

Why are PostgreSQL Text-Search GiST indexes so much slower than GIN indexes?

I'm testing out the PostgreSQL Text-Search features, using the September data dump from StackOverflow as sample data. :-) The naive approach of using LIKE predicates or POSIX regular expression matching to search 1.2 million rows takes about 90-105 seconds (on my Macbook) to do a full table-scan...

0
голосов
3ответов
1808 просмотров

using aggregate function with more than two columns

I have two tables, stats and stat_log. The stat log is like this: user_id,stat_id,value,registered and It logs the value of the stats for the given times. I need every last value from every stat for a given user. So i want something like this, but with values: select stat,max(registered) from...