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 earl

[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... 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 wor

[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

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 opposit

[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] 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

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: Right then, I think I've got this sorted, DROP TABLE worked after a swift: DELETE FROM pg_depend WHERE objid = 5173132; There's something awfully flaky going on here. The system should never have let you get into this st

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 swi

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 c

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 Web Developer &

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

2004-10-06 Thread Mark Gibson
hema using 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 Web Developer & Database Admin Cromwell Tools Ltd. Leicester, England. ---(en

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. -- M

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. :(

[GENERAL] Forwarding kerberos credentials

2004-08-19 Thread Mark Gibson
ot;; $db = pg_connect($connstr); $res = pg_query($db,"SELECT current_user, session_user;"); print_r(pg_fetch_all($res)); pg_close($db); ?> Cheers -- Mark Gibson Web Developer & Database Admin Cromwell Tools Ltd. Leicester, England. ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

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

2004-04-20 Thread Mark Gibson
of array's: Is there any 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. C

Re: [GENERAL] postgresql system column errors

2004-02-16 Thread Mark Gibson
ns? 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 Web Developer & Database Admin Cromwell Tools Ltd. Leicester, England. ---(en

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

2004-02-06 Thread Mark Gibson
JOIN 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

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 Admi

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

2004-02-05 Thread Mark Gibson
Postgres 7.4.1. Regards, Iker You need to quote 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.

[GENERAL] dblink - custom datatypes don't work

2004-02-05 Thread Mark Gibson
actical). Is this a limitation of PostgreSQL or dblink? 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 findi