postgresql

Why do some Django ORM queries end abruptly with the message "Killed"?

Sometimes, when fetching data from the database either through the python shell or through a python script, the python process dies, and one single word is printed to the terminal: Killed That's literally all it says. It only happens with certain scripts, but it always happens for those scripts. It consistently happens with this one sin...

Encapsulating Postgres query in view makes it extremely slow

I have a query that runs in about 5 seconds on Postgres 8.4. It selects data from a view joined to some other tables, but also uses the lag() window function, ie. SELECT *, lag(column1) OVER (PARTITION BY key1 ORDER BY ...), lag(...) FROM view1 v JOIN othertables USING (...) WHERE ... For convenience I created a new view that simply h...

PostgreSQL table design -- how to avoid reusing IDs

I'm designing an app with a rather complex table design using the Postgres database, and am stuck on one point that I was hoping someone could offer advice about. I have several tables, each of which has a feature id (or fid). Different types of entities have different attribute schemas, so I have to create a different table for each t...

can you use libraries in PL/Perl

I'm just curious if when writing PL/Perl functions if I can have a use My::Lib; statement, or enable pragma's and features (e.g. 'use strict; use feature 'switch';). ...

Converting a postgresql database to mysql?

I've been a'Googling and there's all sorts of various forms of crazy ideas out there, but, dear Stack Overflow geniuses, is there a stable, reliable form of converting a postgresql database to a mysql database on Linux? ...

Pgsql Stored Procedures or Rails classes?

This is more to do with maintenance issues for a Rails app. Currently , it has a lot of stored procedures (Postgres -pgsql) and I 'm wondering if I should do away with them and translate them into Rails classes. Performance-wise would rails classes be a better idea than pgsql stored procs? Thanks! ...

disable NOTICES in psql output

How do I stop psql (postgres?) from outputting 'useless' notices? e.g. psql:schema/auth.sql:20: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users" yes psql I know, now be a good tool and stop telling me that you're doing things I want you to do. IMO a program should be silent unless it has an...

Postgres ODBC connection with named pipes on Windows

I'm developing an application in c# .NET that is connected to a PostgresSQL database through TCP/IP with ODBC. It is possibile to connect through named pipes ? How can i do ? Do i need to modify connection string ? ...

Postgres statistic gathering

Statistics can be turned off for specific columns on a table. Can someone point me to the pg table that tells me which columns of a relation are not having stats gathered on? I have already looked at pg_stats and pg_statistics ...

How to generate a hash of the result set in Postgress?

Hi. I have two databases for logging stuff, which I want to check for synchronization. The solution approved is to send periodically (lets say hourly) a select to both, generate a hash of the result set and compare them. If they match then great, otherwise generate some alarms. Currently I'm doing it by (bash script): log_table="SEL...

Moving Postgres tablespaces and tables across EC2 instance

I have postgres database running on Amazon EC2 instance. I have few tablespaces created for some monthly tables, such that each table is on individual tablespace. To get the maximum performance, I have created each tablespace on individual amazon ebs volume. I want to move some of this tables to different instance and database. I will e...

Command.Prepare() Causing Memory Leakage?

I've sort of inherited some code on this scientific modelling project, and my colleagues and I are getting stumped by this problem. The guy who wrote this is now gone, so we can't ask him (go figure). Inside the data access layer, there is this insert() method. This does what it sounds like -- it inserts records into a database. It is ...

Select Difference Between Rows (Postgres)

i'm aggregating facebook "like" counts for urls over time. each hour, i check the "like" count and insert it into a timestamped row. how can i get the difference in total between the new row and the previous hour's row? eg, insert total=5 for id=1 at 2pm insert total=12, diff_since_last=7 for id=1 at 3pm thanks! ...

postgresql insert multiple rows - fail

I'a using PostgreSQL 8.1.11 AND I'm loosing my mind why I can not use a basic SQL statement as INSERT I provide: INSERT INTO the_leads_details ( id, lead_id, question_id, i_value, c_value ) VALUES ( 1, 1, 1, NULL, '4500' ), ( 2, 1, 2, 1, NULL ); ^ this coma is a problem What I am missing ? This seems lik...

Learning resources for secure web development (SQL specifically)

I am a relatively experienced hobbyist web developer, but am concerned about my lack of knowledge covering potential security holes in web sites/services. I am looking for documentation covering best practices regarding security, especially when dealing with SQL databases. Attempts at searching are being thwarted by the fact that Google...

Are users commonly implemented as Roles with the ability to login?

In recent versions of PostgreSQL users are implemented as roles that can login. Is this common in an RBAC implementations, that a user is just another role with the ability to login (or similar)? Some of what I've read so far doesn't suggest that... but maybe I've misread or just not read the right thing. ...

User-created database structure: non-relational or relational databases?

I want to have dynamic fields in my database records. For example: I want to build an application for users to create their own forms. A user could create the following forms: Personal profile: Full Name Street Job Phone Home Work Mobile Interests Interest 1 Interest 2 Interest 3 Work: First name Last name Work Department ...

postgresql request over several schema

Hello, I have a database, with every users having a schema. Is there a way to query a table in every schema? Something like: select id, name from *.simulation doesn't work... Thank you for your help ! ...

How to labele data when creating SHP from SQL?

I am using shell_exec("pgsql2shp.exe ....")in PHP and I got shp file but without labeled points (data) when visualizing..What I need is points with labeled data (names of points) as I can do in ArcMap. Thank you. ...

postgresql stored procedure with query on several schema

Hello, After some answer on a previous question (request over several schema), I try to write a stored procedure to select tables for several schemas (Each user have a schema). create or replace public.select_simulations() returns setof simulation as $$ declare users pg_user%ROWTYPE; simu simulation%ROWTYPE; begin for user...