postgresql

What Do PostgreSQL INSERT confirmation params mean?

I am new to PostgreSQL and I searched high and low but cannot find an answer to this question in my LiveCode Server app I'm getting a dberr returned on insertion but no explicit error code. I went on terminal and did the insertion by hand as user Postgres %My_Dbase=# INSERT INTO new-table (first_name, last_name, anonymous) VALUES ('ba...

How do I change the NAMEDATALEN configuration after installing PostgreSQL 9.0?

I'm supporting some legacy PostgreSQL 8.3/4 databases, and migrating them onto some newer Windows Server 2008 hardware. I've been informed that the NAMEDATALEN figure needs to be higher than the default. As far as I understand, the NAMEDATALEN configuration does not exist in a config file, but rather needs to be set on compiling the ap...

PostGreSQL without password prompt : .pgpass ignored

Hello all, I'm trying to enable root (Ubuntu 8.04) to use psql command without password prompt (for scripting purpose). Everything worked fine with PostGreSQL 8.3, but I migrate to PostGreSQL 8.4 and the login without password doesn't work anymore. I've a correct .pgpass file (the same used for 8.3), the right of /root/.pgpass are 0600...

Granting privileges to ALL objects in a database - Postgres

Hi folks, I'm trying to backup my database with: pg_dump my_database > backup.sql unfortunately there are no privileges set for many objects in the database, therefore the command does not work! Furthermore this does not grant privileges as expected: GRANT ALL ON DATABASE my_database TO root Any ideas? ...

How to get list of all objects? - PostgreSQL

Hi folks, I need a list of the objects included in the db: tables, sequences, etc... Getting the list of tables was the only thing I was able to find out. Any ideas for what I could use in order to obtain everything? ...

Match similar zip codes

Background To replace invalid zip codes. Sample Data Consider the following data set: Typo | City | ST | Zip5 -------+------------+----+------ 33967 | Fort Myers | FL | 33902 33967 | Fort Myers | FL | 33965 33967 | Fort Myers | FL | 33911 33967 | Fort Myers | FL | 33901 33967 | Fort Myers | FL | 33907 33967 | Fort Myers...

Postgres SQL for joining parent-child audit tables

We're using a "1 audit table for each monitored Table" design; However, in our case emp(PARENT) table has a child table emp_address which also needs to be monitored, so we have emp_audit and emp_addr_audit tables. postgres audit SQL : how to join PARENT and CHILD tables for reporting purposes. /* Employee table */ create table emp...

heroku db:pull not working

heroku db:pull postgresql://root:@localhost/db_name After this command display this message /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:50: warning: parenthesize argument(s) for future version Loaded Taps v0.3.13 Warning: Data in the database 'postgresql://root:@localhost/db_name' will be overwrit...

What kind of overhead do non clustered indexes add?

If you are talking about btrees, I wouldn't imagine that the additional overhead of a non clustered index (not counting stuff like full text search or other kind of string indexing) is even measurable, except for an extremely high volume high write scenario. What kind of overhead are we actually talking about? Why would it be a bad ide...

Query to read a query in a file

I have huge create table queries (100's of Gb) which I'd like to ship throught ODBC to my db (Postgre in that case). The problem is that these queries are built from an external program, so I would like to avoid loading each query in memory to ship it by ODBC to the db. I would much prefer to indicate to the db in a (small) query to go ...

How do you connect to a recently create postgres database?

I am just learning sql and starting with PostgreSQL. Here is what I am trying to do: psql postgres CREATE DATABASE newdb; Then I want to do something like this (in the same psql session) CONNECT DATABASE newdb; Of course this doesn't work. But after doing the statement I should be able to do something like: CREATE TABLE newtable ...

.Net DateTime.Now vs PostgreSQL timestamp Comparison

Environment Mono, PostgreSQL, .Net MVC, Windows I'm try to show all events that occur in the future. In order to do that I'm using the following SQL: NpgsqlCommand command = new NpgsqlCommand("SELECT * FROM dinners WHERE EventDate >= " + DateTime.Now, dinnerConn); Now, if I compare DateTime.Now and my EventDate timestamp from the D...

Force PostgreSQL to release allocated memory

Hi, My Postgres hits the max permitted memory under the load (500MB) and runs 14 processes. Once load is over, Postgres still keeps the allocated memory and runs 14 processes. Since I have Apache and Tomcat running on the same machine, I'd like to Postgresql release the allocated memory. Is it possible? Thanks! ...

Weighing High-Volume Database Servers

Hey guys, I suppose this is partially subjective in that it's probably dependent on everyone's interpretation of "high volume", but for the sake of discussion, I'd like to approach this in a hypothetical way. Also, if this is something that should be exclusive to ServerFault, let me know and I'll happily repost there. Obviously there ...

Delete duplicate rows accoding to condition

I am using PostgreSQL database. I have the data like below. id name1 name2 modified_date - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 40 Balfe | Pat | 2010-10-01 17:48:44.804823 41 Battigan | David | ...

PostgreSql + Searching Issue for "'" present in string

Here, I have a problem in searching record in Postgresql DB in RoR Application. Name of table :: address_books, name of attributes :: organization_name, federal_tax_id, city, zip , business_name. In search, organization name contain :: Claire's Inc as record. At the time of searching, it does not show the data while we select Claire's I...

Compile PostgreSQL with reverse endianness

My old iMac G5 died recently. I had a PostgreSQL instance running there, and I kept backups. But when I went to restore them in my newer Macbook Pro, I realized that I couldn't do the restore due to byte endianness differences. Is there any compile flags that I can pass to PostgreSQL's configure script to use a reversed endianness on In...

How large to make name fields in database?

There's an old question that asks this very thing, but a lot has changed in databases and unspoken standards. I generally live by the rule as to never make a field size text or memo, even if it speeds up the database. Primarily because someone could flood and possibly hack the db if there are no restrictions in the input interface. ...

Finding Foriegn Keys From Unknown Database SQL and Java

I have a java program that queries through any type of database with any amount of tables. The user can put in a string and it will return the table and rows containing that string. The problem is that some of these tables have foreign keys. How could I recursively go through all of tables finding foreign keys and rows without any knowle...

Postgresql Serialize

Is it possible to search a field that was serialized in php and stored like that in postgresql ? ...