postgresql

How to make a view not updatable in postgresql

Hi all, I am using PostgreSQL to store business data in large amount for data warehousing purpose. I am writing views to customize the materialized tables. I am wondering whether it is possible to set a view not updatable. I have checked the postgresql manual, but found no specific answer. Many thanks in advance. ...

Can I use PostgreSQL 8.3.x for OpenStreetMap?

Hi! I'm trying to install phpPgAdmin as an XAMPP addon when I encountered an error because the latest phpPgAdmin supports upto PostgreSQL version 8.3.x. So I decided to install PostgreSQL 8.3.11 instead of the latest (PGSQL 8.4.x). Will this matter to my OSM application? Thanks! ...

ERROR: invalid input syntax for type date: ""

I have the following psql query and can't understand why I get error ERROR: invalid input syntax for type date: "". My query looks as follows: SELECT count(*) FROM campaigns WHERE dstart >= '2010-09-02' AND dend <= '2010-09-02' AND status != 'S' AND status != 'C' AND status != 'E' AND (dsignoff <> '' AND...

How can I add PostgreSQL support in PHP bundled in XAMPP?

Apache: v.2.2.14 PHP: 5.3.1 PostgreSQL: 8.4 XAMPP: version 1.7.3 ...

Transaction on postgresql not comitted, mapped objects are not being persisted with autoCommit=false

Mapped objects are not being persisted in DB (Postgresql 8.4) when calling persist in a running transaction. I am using Spring Transaction Management with the org.springframework.jdbc.datasource.DataSourceTransactionManager so everything should be fine. I set the autocommit-mode on the DataSource to "false". When setting the mode ...

Postgresql autocomplete?

Is there something that provides auto-completion for PostgreSQL? I'm looking for something similar to RedGate's SQLPrompt. Currently using pgAdmin III's query tool but willing to consider other query editors. ...

django, postgres 8.4, psycopg 2.2.2, python 2.7, mod_wsgi

I've installed django/postgres on local django server and works fine. I'm trying to get Apache working. I've set up the mod_wsgi and was able to get a "Hello World", and restart Apache. I'm almost there, but when I bring up localhost/index.html I get this server error: TemplateSyntaxError: Caught ImproperlyConfigured while rendering:...

SQL Query value divided by the max(value)

Hi, I'm ashamed of myself 'cause i can't do this query properly... I have a table like this nom | code_geo | valeur | indice -------+----------+--------+-------------------- AISNE | 02 | 81573 | 0.05 SOMME | 80 | 79520 | 0.03 OISE | 60 | 70004 | 0.09 what i need to do is divide each "indice" by the m...

Strategies for Encryption with Django + Postgres?

I'm going to be storing a few sensitive pieces of information (SSN, Bank Accounts, etc) so they'll obviously need to be encrypted. What strategies do you recommend? Should I do all the encryption/decryption in the web app itself? Should I use something like pgcrypto and have the conversions done on the DB side? Something else entirel...

Data arrays in Django model

I am just starting out with Django and would like to know the best way to deal with the following data. I have DataSets which are comprised of many x,y coordinate pairs which I wish to plot. It is my understanding that Django doesn't support numeric arrays directly in it's models so what is the best way to deal with these? Right now all ...

postgres connections exceeding max_connections?

we are running a very connection-heavy, insert-heavy postgres database (to the point that we should've done some connection pooling, but there's no time now). when doing some troubleshooting, i was using netstat to show me how many connections there were to postgres. i would commonly see more than what i had specified in the postgres.c...

postgresql 8.4 trigger/storedproc error : how to fix it ?

Hi there, An INSERT on a table triggers a stored proc where the following error occurs. ERROR: column "targetedfamily" is of type boolean but expression is of type character varying Hint: You will need to rewrite or cast the expression. Where: PL/pgSQL function "fn_family_audit" line 19 at SQL statement And here's the ERRING stor...

How to search keyword in 100 billions of posts ?

This is a college project: I have a database ( mysql or postgresql doesn't matter ) with 100 billion of posts and I need to search ( as fast as possible ) a generic keyword. Every post is 500-1000 keywords. This isn't only a database issue but also a software ( for indexing or other ) issue. How can I do that ? I could use some adva...

Postgres: Find position of a specific row within a resultset?

Hello, I'm trying to figure out how to get the relative position of a single item in a query relative to all the items returned from the query. For example,the long hand way of getting the answer would be: single_item = SELECT * FROM table WHERE id=65 result = SELECT * FROM table WHERE published_date < date_value x=1 foreach(result as...

Postgresql: Update problem

Hi, I want to do some updates, which logically looks like below - UPDATE t1 SET (x1, x2) = (SELECT x1, x2 FROM t1 WHERE id_1 = 8 AND id_2 =1 AND id_3 = 3) ; But from the documentation it looks like...

Rails, Count and Group

I have a table like: +--------+-----------+-------+-----------+ |house_no|house_alpha|flat_no|street_name| +--------+-----------+-------+-----------+ | 1| | |James St | | 1| | |James St | | 1| | |James St | | 2| A| |James St | | ...

Shredding XML in postgresql

In SQL Server 2005's T-SQL language I can shred XML value the following way: SELECT t.c.value('./ID[1]', 'INT'), t.c.value('./Name[1]', 'VARCHAR(50)') FROM @Xml.nodes('/Customer') AS t(c) where @Xml is a xml value something like '<Customer><ID>23</ID><Name>Google</Name></Customer>' Can someone help me to achieve the same ...

PostgreSQL, how can i restrict access to code in a function for a user?

I found out how to deny all access to tables for user in a schema. REVOKE ALL PRIVILEGES ON SCHEMA test FROM user; But what can i do to restrict access to all functions in a schema, so that user couldn't read the code? I was trying this: REVOKE ALL ON FUNCTION test.test_function(text) FROM user; Yes, it has restricted the ability ...

unexpected chunk size 1996 (expected 1600) in final chunk 1 for toast

Hi, I am getting this error in my server.How can i resolve this error. with regards, chandrasekhar...

PHP for an OpenStreetMap Application

Hi! I'm doing a project using OpenStreetMap and OpenLayers. Currently, my task is to insert the data from the OSM file that I have to a PostgreSQL. When I checked out Osmosis (the tool for transferring data from the OSM file to the database), it says there that, in one example, "Import a planet file into a local PostgreSQL rails port dat...