Re: [SQL] Primary key reference count

2006-04-23 Thread Wiebe Cazemier
On Wednesday 19 April 2006 19:21, Volkan YAZICI wrote:

> Here's simple query, to list which table's which columns references to a
> specific table. (Hope this is what you asked for.)
> 
> SELECT TBL.table_name, COL.column_name
> FROM information_schema.referential_constraints AS REF
> INNER JOIN information_schema.table_constraints AS TBL
>USING (constraint_name)
> INNER JOIN information_schema.constraint_column_usage AS COL
>USING (constraint_name)
> INNER JOIN information_schema.table_constraints AS PRI
>ON (PRI.constraint_name = REF.unique_constraint_name)
> WHERE PRI.table_name = 'pri_id'; -- Your target table goes here.
> 
> This is a quick & dirty hack. Just wanted to show the possibility of the
> idea using information schema. (You don't want to deal with internal
> tables, ain't?)

I know the reply is somewhat late, but indeed, this would seem to be what I was
looking for. And, using the information schema instead of pg_catalog would
seem to be a better idea as well :)


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[SQL] date array

2006-04-23 Thread A. R. Van Hook

How do you add null values to a date array?

update dattable set insDate = '{04/12/2006,'null'}<-- doesn't work
update dattable set insDate= '{04/12/2006,null}' <-- doesn't work
update dattable set insDate= '{04/12/2006,''}' <-- doesn't work

the table field is defined as insDate date[]




thanks


--
Arthur R. Van Hook
 Mayor 
The City of Lake Lotawana


[EMAIL PROTECTED]

(816) 578-4704 - Home
(816) 578-4215 - City
(816) 564-0769 - Cell


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


Re: [SQL] date array

2006-04-23 Thread Bruno Wolff III
On Sun, Apr 23, 2006 at 07:55:54 -0500,
  "A. R. Van Hook" <[EMAIL PROTECTED]> wrote:
> How do you add null values to a date array?
> 
> update dattable set insDate= '{04/12/2006,null}' <-- doesn't work

That is the correct format. However, I think that only works in HEAD
(what will become 8.2 in about 6 months).

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] date array

2006-04-23 Thread Bruno Wolff III
Please keep responses copied to the list. This both helps other people with
similar questions by getting the discussion in the archives and helps you
by letting other people see your additional questions.

On Sun, Apr 23, 2006 at 13:21:49 -0500,
  "A. R. Van Hook" <[EMAIL PROTECTED]> wrote:
> I am running 8.1.2, what can I do in the mean time?

You could build from source using HEAD. (This is probably not a good idea for
a production system.)
You could restructure your data model to not use arrays. (You probably
shouldn't be using them anyway. Arrays should be used for things that are
naturally arrays (e.g. vectors) and I would be surprised if this was the
case when you are storing dates.)

Also note that 8.1.3 is out and 8.1.4 will probably be out soon, so you
should be looking to upgrade in any case.

> 
> 
> thanks
> 
> Bruno Wolff III wrote:
> 
> >On Sun, Apr 23, 2006 at 07:55:54 -0500,
> > "A. R. Van Hook" <[EMAIL PROTECTED]> wrote:
> > 
> >
> >>How do you add null values to a date array?
> >>
> >>update dattable set insDate= '{04/12/2006,null}' <-- doesn't work
> >>   
> >>
> >
> >That is the correct format. However, I think that only works in HEAD
> >(what will become 8.2 in about 6 months).

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq