[GENERAL] How access table by tableoid

2007-05-13 Thread Felix Kater
Hi, can I use a given tableoid (instead of the tablename) to select columns from that table somehow? SELECT * FROM ??tableoid?? My first approach was to lauch a subquery of the information_schema like this: SELECT * FROM (SELECT relname FROM pg_class WHERE oid=999) AS tablename However, it tur

Re: [GENERAL] are foreign keys realized as indexes?

2007-05-09 Thread Felix Kater
On Tue, 8 May 2007 15:54:08 +0200 Martijn van Oosterhout <[EMAIL PROTECTED]> wrote: > A unique index is not a "substitute" for a unique constraint, they're > exactly the same thing. If you drop your constraint and create a > unique index, you're back where you started. You neither added nor > remo

Re: [GENERAL] pg_contraint: 'action code' ?

2007-05-09 Thread Felix Kater
On Tue, 08 May 2007 10:03:24 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. True! ;-) Thank you so much. Felix ---(end of broadcast)--- TIP 6: explain analyze is your friend

[GENERAL] pg_contraint: 'action code' ?

2007-05-08 Thread Felix Kater
Hi, where are the 'action code' (type char) of foreign keys defined for ON DELETE resp. ON UPDATE for the actions NO ACTION, RESTRICT, CASCADE, SET NULL, SET DEFAULT in pg_contraint? In the manual (8.2) it is mentioned but not explained. Thank You Felix ---(end of broadc

Re: [GENERAL] are foreign keys realized as indexes?

2007-05-08 Thread Felix Kater
On Tue, 8 May 2007 14:19:12 +0200 Peter Eisentraut <[EMAIL PROTECTED]> wrote: > > I like to keep my pg interface small: Can I replace foreign keys by > > using indexes somehow? > > Not while preserving the semantics. I am not bound to indexes, however, wonder if foreign keys itself are non-atomi

Re: [GENERAL] are foreign keys realized as indexes?

2007-05-08 Thread Felix Kater
On Tue, 08 May 2007 12:48:30 +0100 Raymond O'Donnell <[EMAIL PROTECTED]> wrote: > You can do that, but you'll lose the enforcement of referential > integrity, which is what foreign keys give you. If I get you right: There is *no complete* substitute for foreign keys by using *indexes* since I'd

[GENERAL] are foreign keys realized as indexes?

2007-05-08 Thread Felix Kater
Hi, I like to keep my pg interface small: Can I replace foreign keys by using indexes somehow? (This is at least possible for primary key columns which can be replaced by suitable indexes.) Thank You Felix ---(end of broadcast)--- TIP 1: if posting

[GENERAL] binary representation of date and numeric

2007-04-27 Thread Felix Kater
Hi, what is the binary representation of 'date' and 'numeric' data? I am using PQexecParam (C binding libpq-8.0.12) with binary export switched on. From the three examples in C code the types 'int4', 'bytea' and strings are covered, however nothing about 'date', 'numeric'. If there is no documen

Re: [GENERAL] PQerrorMessage: suppress trailing new line?

2007-04-24 Thread Felix Kater
On Tue, 24 Apr 2007 11:14:43 +1200 "Andrej Ricnik-Bay" <[EMAIL PROTECTED]> wrote: > On 4/24/07, Felix Kater <[EMAIL PROTECTED]> wrote: > > Hi, > > > > the messages returned by PQerrorMessage() contain a trailing new > > line. So, they doesn't

[GENERAL] PQerrorMessage: suppress trailing new line?

2007-04-23 Thread Felix Kater
Hi, the messages returned by PQerrorMessage() contain a trailing new line. So, they doesn't nicely integrate into strings formatted by printf. Is there a way to suppress the trailing new line (except for alloc/copy to a new string)? Thank You Felix ---(end of broadcast)-

[GENERAL] unique ID across all columns

2007-04-17 Thread Felix Kater
Hi, I need a unique ID across all columns I create. Is it o.k. to achive this by combining pg_attribute.attnum of a column together with the OID of the table the column is in? While the table's OID should be unique according to the manual, I have found no hints about the uniqueness of attnum -- I