Re: [GENERAL] casting... adding integer to timestamp

2006-06-25 Thread Mark Gibson
Michael Glaesemann wrote: On Jun 25, 2006, at 14:23 , Mark Gibson wrote: SELECT play_length - INTERVAL 'play_seconds seconds' ... The column isn't interpolated into the string. Try SELECT play_length - play_seconds * INTERVAL '1 second' That worked great! Thanks! Mark

[GENERAL] Casting and Timestamp

2006-06-25 Thread Mark Gibson
I have unexpected results when trying to cast a string to a timestamp: test=# select TIMESTAMP WITH TIME ZONE '2006/06/25 06:00:00 GMT-5' test-# ; timestamptz 2006-06-24 20:00:00-05 Seems that what I get is about 10 hours earlier than I expect... Any ideas why

Re: [GENERAL] Casting and Timestamp

2006-06-25 Thread Mark Gibson
Mark Gibson wrote: I have unexpected results when trying to cast a string to a timestamp: test=# select TIMESTAMP WITH TIME ZONE '2006/06/25 06:00:00 GMT-5' test-# ; timestamptz 2006-06-24 20:00:00-05 Seems that what I get is about 10 hours earlier than I

[GENERAL] casting... adding integer to timestamp

2006-06-24 Thread Mark Gibson
If play_length is a timestamp, I can do this: SELECT play_length - INTERVAL '13 seconds' ... But what if play_seconds is a column? SELECT play_length - INTERVAL 'play_seconds seconds' ... This doesn't work. ERROR: invalid input syntax for type interval: play_seconds seconds Can anyone

[GENERAL] string primary key

2006-05-11 Thread Mark Gibson
Is there a disadvantage to having the primary key for a table be a text type vs. an integer type? Performance? Any difference between having a varchar or char as a primary key? My instinct tells me that an integer is preferred, but I'm looking for a more concrete answer. Thanks, Mark

Re: [GENERAL] string primary key

2006-05-11 Thread Mark Gibson
Scott Marlowe wrote: If you need a unique constraint on the text field anyway, and it's a natural key, you're generally better of using that field as the pk. However, if it's not a natually unique key, then it shouldn't be the pk, and int is a perhaps better choice. There are two VERY

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP

2004-10-15 Thread Mark Gibson
Andrew Sullivan wrote: On Wed, Oct 06, 2004 at 05:25:58PM +0100, Mark Gibson wrote: I had to remove Slony's schema manually as I was having problems with it. I was in the process of removing all Slony related stuff, and all my slave tables when this problem occurred, and was going to start again

[GENERAL] Cache lookup failed for relation, when trying to DROP TABLE.

2004-10-06 Thread Mark Gibson
the pg_catalog tables? Is there any other information I should provide that may help? Specs: Redhat Enterprise Linux 3 PostgreSQL 7.4.5 Slony-I 1.0.2 Cheers -- Mark Gibson gibsonm |AT| cromwell |DOT| co |DOT| uk Web Developer Database Admin Cromwell Tools Ltd. Leicester, England

Re: [GENERAL] Commands to browse current connections and processes

2004-10-06 Thread Mark Gibson
Ying Lu wrote: Hello, In mysql, we use show processlist to see all current process. Could someone let me know in PostgreSQL, what commands that we can check the current connections and processes please? SELECT * FROM pg_catalog.pg_stat_activity; -- Mark Gibson gibsonm |AT| cromwell |DOT| co |DOT

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP

2004-10-06 Thread Mark Gibson
Tom Lane wrote: Mark Gibson [EMAIL PROTECTED] writes: I kept getting the following error: ERROR: cache lookup failed for relation 4667548 This implies that something someplace still has a link to the table with that OID. You could do \set VERBOSITY verbose so that the code location the error

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP

2004-10-06 Thread Mark Gibson
Mark Gibson wrote: I'm guessing I'm gonna have to route through pg_catalog for this and delete all deps manually, but it this going to be safe? Would I be better off dumping and restoring the whole database? Right then, I think I've got this sorted, DROP TABLE worked after a swift: DELETE FROM

Re: [GENERAL] Heritage

2004-09-09 Thread Mark Gibson
easily delete the person in tbl_everyone and insert it again in tbl_employees... Have you tried deferred constraints, eg: BEGIN; SET CONSTRAINTS ALL DEFERRED; DELETE ...; INSERT ...; END; I've haven't had chance to test this, but I think this could be what you're looking for. -- Mark Gibson gibsonm

Re: [GENERAL] Forwarding kerberos credentials

2004-08-20 Thread Mark Gibson
Mark Gibson wrote: Hi, I'm having intermittent problems connecting to my PostgreSQL database from PHP, using Kerberos credentials forwarded from mod_auth_kerb. [snip] The trouble is that sometimes the connection works, and sometimes it doesn't. It's very unpredictable. :( Oh, I forgot

[GENERAL] Forwarding kerberos credentials

2004-08-19 Thread Mark Gibson
;); print_r(pg_fetch_all($res)); pg_close($db); ? Cheers -- Mark Gibson gibsonm |AT| cromwell |DOT| co |DOT| uk Web Developer Database Admin Cromwell Tools Ltd. Leicester, England. ---(end of broadcast)--- TIP 7: don't

[GENERAL] Can I reset the lower bound of an array.

2004-04-20 Thread Mark Gibson
way to specify array slices from a subscript to the beginning or end of an array? eg: element to end: array[5:*] beginning to element: array[*:5] At present it is possible by using an extreme +ve or -ve subscript value, but this isn't nice. Cheers -- Mark Gibson gibsonm |AT| cromwell

Re: [GENERAL] postgresql system column errors

2004-02-16 Thread Mark Gibson
? The only thing you can do is change your column name. The manual tells you about the system columns here: http://www.postgresql.org/docs/7.4/static/ddl-system-columns.html -- Mark Gibson gibsonm |AT| cromwell |DOT| co |DOT| uk Web Developer Database Admin Cromwell Tools Ltd. Leicester, England

Re: [GENERAL] newbie question... how do I get table structure?

2004-02-06 Thread Mark Gibson
pg_catalog.pg_namespace n ON (c.relnamespace = n.oid) INNER JOIN pg_catalog.pg_attribute a ON (a.attrelid = c.oid) WHERE n.nspname = '{schema_name}' AND c.relname = '{table_name}' AND a.attisdropped = false AND a.attnum 0 Replace {schema_name} and {table_name}. -- Mark Gibson

[GENERAL] dblink - custom datatypes don't work

2004-02-05 Thread Mark Gibson
? Could dblink use type names instead of oid's? If not, could dblink be adapted to use some kind of remote oid - local oid mapping table for datatypes? I would be willing to have a poke around in dblink.c, if someone could confirm my findings and point me in the right direction. Cheers -- Mark Gibson

Re: [GENERAL] ERROR: column 'xxx' does not exist (under v. 7.4.1)

2004-02-05 Thread Mark Gibson
the table name if it contains upper case or strange characters: SELECT companyID FROM app; -- Mark Gibson [EMAIL PROTECTED] Web Developer Database Admin Cromwell Tools Ltd. Leicester, England. ---(end of broadcast)--- TIP 3: if posting/reading through

Re: [GENERAL] ERROR: column 'xxx' does not exist (under v. 7.4.1)

2004-02-05 Thread Mark Gibson
Mark Gibson wrote: You need to quote the table name if it contains upper case or strange characters: SELECT companyID FROM app; Obviously I meant column name, but it applies to any object identifier ;) -- Mark Gibson [EMAIL PROTECTED] Web Developer Database Admin Cromwell Tools Ltd