Re: [GENERAL] How to generate a valid postgre TIMESTAMP with PHP?

2010-03-28 Thread APseudoUtopia
On Sun, Mar 28, 2010 at 2:27 PM, Andre Lopes lopes80an...@gmail.com wrote: Hi, I'am writing some code in PHP and I need to generate a valid postgresql TIMESTAMP with PHP. Any PHP programmer thar can help me on how to generate valid TIMESTAMP's with PHP? Sorry my bad english. Best

[GENERAL] Order of Daily VACUUM, CLUSTER, REINDEX

2010-03-19 Thread APseudoUtopia
Hey list, I have a cron script that runs a couple cleanup commands on my database. It runs three commands: VACUUM ANALYZE; CLUSTER; REINDEX DATABASE database; They are run in the above order. I was wondering if there's a better order to do this in. For example, should the ANALYZE be run _after_

Re: [GENERAL] pg dump.. issue with when using crontab

2010-01-26 Thread APseudoUtopia
On Tue, Jan 26, 2010 at 11:54 AM, Moe mohamed5432154...@gmail.com wrote: Hi folks, I have a simple script file db : #!/bin/bash pg_dump -U postgres prodDB /var/a/db/$(date +%Y-%m-%d_%H:%M)-prodDB.dump -- Which works fine when executed manually ( ./db ).. I get a dump file which

Re: [GENERAL] Deleting 100 rows which meets certain criteria

2009-12-30 Thread APseudoUtopia
On Wed, Dec 30, 2009 at 12:11 PM, shulkae shul...@gmail.com wrote: I am newbie to postgres/SQL. I want to delete all rows exceeding 400 hours (10 days) and I want to limit deletion of only 100 records at a time. I was trying the following in PostgreSQL: DELETE from mytable WHERE (now() -

Re: [GENERAL] Error when creating table with boolean data type

2009-11-17 Thread APseudoUtopia
On Tue, Nov 17, 2009 at 7:15 PM, William Carithers wccarith...@lbl.gov wrote: On 11/17/09 4:04 PM, William Carithers wccarith...@lbl.gov wrote: I get an Error: relation boolean does not exist when attempting to create a table with columns of data type boolean. I using PostgreSQL 8.3.6 and the

Re: [GENERAL] Vacuumdb Fails: Huge Tuple

2009-10-06 Thread APseudoUtopia
On Thu, Oct 1, 2009 at 5:02 PM, Tom Lane t...@sss.pgh.pa.us wrote: APseudoUtopia apseudouto...@gmail.com writes: Here's what happened: $ vacuumdb --all --full --analyze --no-password vacuumdb: vacuuming database postgres vacuumdb: vacuuming database web_main vacuumdb: vacuuming of database

[GENERAL] Vacuumdb Fails: Huge Tuple

2009-10-01 Thread APseudoUtopia
Hey list, After some downtime of my site while completing rigorous database maintenance, I wanted to make sure all the databases were fully vacuumed and analyzed. I do run autovacuum, but since I made several significant changes, I wanted to force a vacuum before I brought my site back online.

Re: [GENERAL] Vacuumdb Fails: Huge Tuple

2009-10-01 Thread APseudoUtopia
On Thu, Oct 1, 2009 at 3:10 PM, APseudoUtopia apseudouto...@gmail.com wrote: Hey list, After some downtime of my site while completing rigorous database maintenance, I wanted to make sure all the databases were fully vacuumed and analyzed. I do run autovacuum, but since I made several

Re: [GENERAL] Vacuumdb Fails: Huge Tuple

2009-10-01 Thread APseudoUtopia
On Thu, Oct 1, 2009 at 4:21 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Thu, Oct 1, 2009 at 1:12 PM, APseudoUtopia apseudouto...@gmail.com wrote: Sorry, I failed to mention: PostgreSQL 8.4.0 on i386-portbld-freebsd7.2, compiled by GCC cc (GCC) 4.2.1 20070719  [FreeBSD], 32-bit Have

Re: [GENERAL] do I need a rollback() after commit that fails?

2009-09-29 Thread APseudoUtopia
On Tue, Sep 29, 2009 at 1:26 PM, Vick Khera vi...@khera.org wrote: I'm running Pg 8.3.7 on FreeBSD 7.2. I have some code in Perl that does a bunch of inserts and updates with all constraints deferred.  On occasion, one of the FK's gets violated and the transaction commit fails. I trap this

[GENERAL] tsvector Column Indexing Across Two Tables

2009-09-06 Thread APseudoUtopia
Hey list, I have a forum. I'm in the process of adding a full-text search. The forum is split into a couple tables, including forums_posts and forums_topics. The latter contains only the title of the topic and some other information, like an ID number. The forums_posts table contains the body of

Re: [GENERAL] tsvector Column Indexing Across Two Tables

2009-09-06 Thread APseudoUtopia
On Sun, Sep 6, 2009 at 9:57 PM, APseudoUtopiaapseudouto...@gmail.com wrote: Hey list, I have a forum. I'm in the process of adding a full-text search. The forum is split into a couple tables, including forums_posts and forums_topics. The latter contains only the title of the topic and some

[GENERAL] Full-Text Searching: to_tsquery() vs. plainto_tsquery()

2009-09-04 Thread APseudoUtopia
Hello, I'm working on setting up a full-text search for some descriptions stored in my database. I'm running pg 8.4. From what I can tell, there are two functions. One function, to_tsquery(), requires that boolean operators (, |, !) are between every word. The other function, plainto_tsquery()

Re: [GENERAL] add a value to an ENUM type

2009-09-03 Thread APseudoUtopia
On Thu, Sep 3, 2009 at 12:52 PM, Edoardo Panfiliedoa...@aspix.it wrote: I have an enum type CREATE TYPE shapeName AS ENUM('rectangle','circle'); now I need another value: 'square' the pg_type.oid of 'shapename is 16458 It works, but Is it safe to use this? insert into pg_enum

[GENERAL] Importing Mangled SQL File via psql

2009-08-25 Thread APseudoUtopia
Hey list, I have a dump of a table from a mysql database. I spent the last two days running search-and-replace regexes and other such formatting changes in order to get it loadable into PostgreSQL. I finally got to what seemed like the end of the process, when this happened as I tried to load it:

[GENERAL] Server/Client Encoding Errors

2009-07-25 Thread APseudoUtopia
Hey, I'm having some problems when inserting special characters into a column. Here's the table: -- Table public.users_history_ip Column |Type | Modifiers

[GENERAL] Server Backup: pg_dump vs pg_dumpall

2009-07-20 Thread APseudoUtopia
Hey, I'm writing a backup script. Right now, I only have one database on my postgresql server. I'm deciding if I should use pg_dump or pg_dumpall when backing up the server. As far as I can tell, pg_dumpall cannot compress the dumps automatically and it only dumps data in the standard SQL text

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-30 Thread APseudoUtopia
On Mon, Jun 29, 2009 at 2:26 PM, David Kerrd...@mr-paradox.net wrote: On Sat, Jun 27, 2009 at 08:23:26PM -0400, APseudoUtopia wrote: - Hey list, - - I'm migrating my site away from MySQL to PostgreSQL. So far, it's been - going great. However, there's one problem I've been having trouble

Re: [GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-28 Thread APseudoUtopia
On Sat, Jun 27, 2009 at 9:13 PM, justinjus...@emproshunts.com wrote: APseudoUtopia wrote: Hey list, I have a query which allows users to Catch up on read posts on the forum. It works by either updating or inserting the last post read number from every forum thread into the readposts table

[GENERAL] Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

2009-06-27 Thread APseudoUtopia
Hey list, I'm migrating my site away from MySQL to PostgreSQL. So far, it's been going great. However, there's one problem I've been having trouble solving. I have a query which allows users to Catch up on read posts on the forum. It works by either updating or inserting the last post read

[GENERAL] Opinions on how to Integrate Transactions

2009-06-14 Thread APseudoUtopia
Hey, I'm new to using transactions. I'd like to integrate them into my PHP application to prevent a few issues we've been having. Such as, some queries in the beginning of the php script running, then an error occurring, preventing queries toward the bottom of the script from running. It's

[GENERAL] Modifying ENUM Type

2009-05-30 Thread APseudoUtopia
Hey, I created an ENUM type. However, I accidentally typoed in one of the enum values. It is apps and it should be app. What's the best way to modify this without dropping the type? I have many tables which have columns that depend on the type, and I'm trying to avoid having to recreate all those

[GENERAL] Question on Foreign Key Structure/Design

2009-05-24 Thread APseudoUtopia
Hey list, I have a table with user IDs, among other information. I also have a table of comments that users can place on a page. CREATE TABLE users ( id SERIAL PRIMARY KEY, ... ); CREATE TABLE comments ( id SERIAL PRIMARY KEY, userid INTEGER REFERENCES users (id) ON DELETE RESTRICT,