Обсуждение: Inherits tables and current CVS

Поиск
Список
Период
Сортировка

Inherits tables and current CVS

От
Teodor Sigaev
Дата:
How can I know tables is inherited or no?

# create table parent (
         id      int primary key,
         value   text
);

# create table child (
         cval    text,
         primary key (id)
) INHERITS (parent);

# \d child
      Table "public.child"
  Column |  Type   | Modifiers
--------+---------+-----------
  id     | integer | not null
  value  | text    |
  cval   | text    |
Indexes:
     "child_pkey" PRIMARY KEY btree (id)


\d doesn show any info about inheritance....



--
Teodor Sigaev                                  E-mail: teodor@sigaev.ru


Re: Inherits tables and current CVS

От
Tom Lane
Дата:
Teodor Sigaev <teodor@sigaev.ru> writes:
> How can I know tables is inherited or no?

You have to look in pg_inherits.  AFAIR psql has no \d command that will
tell you anything about it.

            regards, tom lane

Re: Inherits tables and current CVS

От
Bruce Momjian
Дата:
Is this a TODO?

---------------------------------------------------------------------------

Tom Lane wrote:
> Teodor Sigaev <teodor@sigaev.ru> writes:
> > How can I know tables is inherited or no?
>
> You have to look in pg_inherits.  AFAIR psql has no \d command that will
> tell you anything about it.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Inherits tables and current CVS

От
Teodor Sigaev
Дата:

Nick Barr wrote:
> Hi,
>
> Having read the list, and noticed the message about table inheritance I
> thought that I would see if I could come up with a simple solution, and
> have my first delve into the code for PostgreSQL.
>
> Attached is a diff against 7.3.3 source, of changes to describe.c for
> psql. This should print out a list of parent tables in a similar style
> to that of the index listing. I have done some testing on my side and it
> all seems fine, can some other people have a quick look? What do people
> think? Useful?
Cool!! Thank you. But your patch can't be applyed to current CVS:

% patch < ~/describe_inherits.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- describe.c Sat Dec 21 01:07:22 2002
|+++ describe_inherits.c        Thu Jun 26 18:05:17 2003
--------------------------
Patching file describe.c using Plan A...
Hunk #1 succeeded at 928 (offset -13 lines).
Hunk #2 failed at 1021.
Hunk #3 succeeded at 1159 with fuzz 1 (offset 7 lines).
Hunk #4 succeeded at 1162 (offset -13 lines).
1 out of 4 hunks failed--saving rejects to describe.c.rej



--
Teodor Sigaev                                  E-mail: teodor@sigaev.ru


Re: Inherits tables and current CVS

От
"Nick Barr"
Дата:
Heya,

I tested against the original version, CVS 1.71.2.1, and it applied
fine.

------------------------------------
[nkd@WEBBASED postgresql]$ patch -p0 describe.c <
describe_inherits_733.diff
patching file describe.c
[nkd@WEBBASED postgresql]$
------------------------------------

Anyway, I have also put together a 7.4 patch, which is attached, CVS
1.77. I have tested applying this patch and it also works fine.

Hope that's clearer.


Kind Regards,

Nick Barr
WebBased Ltd.

Tel: (01752) 764445
Fax: (01752) 764446
Email: nick.barr@webbased.co.uk

This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.



> -----Original Message-----
> From: Teodor Sigaev [mailto:teodor@sigaev.ru]
> Sent: 26 June 2003 18:42
> To: Nick Barr
> Cc: pgsql-general-owner@postgresql.org; pgsql-general
> Subject: Re: Inherits tables and current CVS
>
>
>
> Nick Barr wrote:
> > Hi,
> >
> > Having read the list, and noticed the message about table
inheritance I
> > thought that I would see if I could come up with a simple solution,
and
> > have my first delve into the code for PostgreSQL.
> >
> > Attached is a diff against 7.3.3 source, of changes to describe.c
for
> > psql. This should print out a list of parent tables in a similar
style
> > to that of the index listing. I have done some testing on my side
and it
> > all seems fine, can some other people have a quick look? What do
people
> > think? Useful?
> Cool!! Thank you. But your patch can't be applyed to current CVS:
>
> % patch < ~/describe_inherits.diff
> Hmm...  Looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- describe.c Sat Dec 21 01:07:22 2002
> |+++ describe_inherits.c        Thu Jun 26 18:05:17 2003
> --------------------------
> Patching file describe.c using Plan A...
> Hunk #1 succeeded at 928 (offset -13 lines).
> Hunk #2 failed at 1021.
> Hunk #3 succeeded at 1159 with fuzz 1 (offset 7 lines).
> Hunk #4 succeeded at 1162 (offset -13 lines).
> 1 out of 4 hunks failed--saving rejects to describe.c.rej
>
>
>
> --
> Teodor Sigaev                                  E-mail:
teodor@sigaev.ru

Вложения

Re: Inherits tables and current CVS

От
Bruce Momjian
Дата:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Nick Barr wrote:
> Heya,
>
> I tested against the original version, CVS 1.71.2.1, and it applied
> fine.
>
> ------------------------------------
> [nkd@WEBBASED postgresql]$ patch -p0 describe.c <
> describe_inherits_733.diff
> patching file describe.c
> [nkd@WEBBASED postgresql]$
> ------------------------------------
>
> Anyway, I have also put together a 7.4 patch, which is attached, CVS
> 1.77. I have tested applying this patch and it also works fine.
>
> Hope that's clearer.
>
>
> Kind Regards,
>
> Nick Barr
> WebBased Ltd.
>
> Tel: (01752) 764445
> Fax: (01752) 764446
> Email: nick.barr@webbased.co.uk
>
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender. You
> should not copy it or use it for any purpose nor disclose or distribute
> its contents to any other person.
>
>
>
> > -----Original Message-----
> > From: Teodor Sigaev [mailto:teodor@sigaev.ru]
> > Sent: 26 June 2003 18:42
> > To: Nick Barr
> > Cc: pgsql-general-owner@postgresql.org; pgsql-general
> > Subject: Re: Inherits tables and current CVS
> >
> >
> >
> > Nick Barr wrote:
> > > Hi,
> > >
> > > Having read the list, and noticed the message about table
> inheritance I
> > > thought that I would see if I could come up with a simple solution,
> and
> > > have my first delve into the code for PostgreSQL.
> > >
> > > Attached is a diff against 7.3.3 source, of changes to describe.c
> for
> > > psql. This should print out a list of parent tables in a similar
> style
> > > to that of the index listing. I have done some testing on my side
> and it
> > > all seems fine, can some other people have a quick look? What do
> people
> > > think? Useful?
> > Cool!! Thank you. But your patch can't be applyed to current CVS:
> >
> > % patch < ~/describe_inherits.diff
> > Hmm...  Looks like a unified diff to me...
> > The text leading up to this was:
> > --------------------------
> > |--- describe.c Sat Dec 21 01:07:22 2002
> > |+++ describe_inherits.c        Thu Jun 26 18:05:17 2003
> > --------------------------
> > Patching file describe.c using Plan A...
> > Hunk #1 succeeded at 928 (offset -13 lines).
> > Hunk #2 failed at 1021.
> > Hunk #3 succeeded at 1159 with fuzz 1 (offset 7 lines).
> > Hunk #4 succeeded at 1162 (offset -13 lines).
> > 1 out of 4 hunks failed--saving rejects to describe.c.rej
> >
> >
> >
> > --
> > Teodor Sigaev                                  E-mail:
> teodor@sigaev.ru

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Inherits tables and current CVS

От
Bruce Momjian
Дата:
This was the actual patch applied.

---------------------------------------------------------------------------

Nick Barr wrote:
> Heya,
>
> I tested against the original version, CVS 1.71.2.1, and it applied
> fine.
>
> ------------------------------------
> [nkd@WEBBASED postgresql]$ patch -p0 describe.c <
> describe_inherits_733.diff
> patching file describe.c
> [nkd@WEBBASED postgresql]$
> ------------------------------------
>
> Anyway, I have also put together a 7.4 patch, which is attached, CVS
> 1.77. I have tested applying this patch and it also works fine.
>
> Hope that's clearer.
>
>
> Kind Regards,
>
> Nick Barr
> WebBased Ltd.
>
> Tel: (01752) 764445
> Fax: (01752) 764446
> Email: nick.barr@webbased.co.uk
>
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender. You
> should not copy it or use it for any purpose nor disclose or distribute
> its contents to any other person.
>
>
>
> > -----Original Message-----
> > From: Teodor Sigaev [mailto:teodor@sigaev.ru]
> > Sent: 26 June 2003 18:42
> > To: Nick Barr
> > Cc: pgsql-general-owner@postgresql.org; pgsql-general
> > Subject: Re: Inherits tables and current CVS
> >
> >
> >
> > Nick Barr wrote:
> > > Hi,
> > >
> > > Having read the list, and noticed the message about table
> inheritance I
> > > thought that I would see if I could come up with a simple solution,
> and
> > > have my first delve into the code for PostgreSQL.
> > >
> > > Attached is a diff against 7.3.3 source, of changes to describe.c
> for
> > > psql. This should print out a list of parent tables in a similar
> style
> > > to that of the index listing. I have done some testing on my side
> and it
> > > all seems fine, can some other people have a quick look? What do
> people
> > > think? Useful?
> > Cool!! Thank you. But your patch can't be applyed to current CVS:
> >
> > % patch < ~/describe_inherits.diff
> > Hmm...  Looks like a unified diff to me...
> > The text leading up to this was:
> > --------------------------
> > |--- describe.c Sat Dec 21 01:07:22 2002
> > |+++ describe_inherits.c        Thu Jun 26 18:05:17 2003
> > --------------------------
> > Patching file describe.c using Plan A...
> > Hunk #1 succeeded at 928 (offset -13 lines).
> > Hunk #2 failed at 1021.
> > Hunk #3 succeeded at 1159 with fuzz 1 (offset 7 lines).
> > Hunk #4 succeeded at 1162 (offset -13 lines).
> > 1 out of 4 hunks failed--saving rejects to describe.c.rej
> >
> >
> >
> > --
> > Teodor Sigaev                                  E-mail:
> teodor@sigaev.ru

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Inherits tables and current CVS

От
Bruce Momjian
Дата:
Newer patch applied.  Thanks.

---------------------------------------------------------------------------


Teodor Sigaev wrote:
>
>
> Nick Barr wrote:
> > Hi,
> >
> > Having read the list, and noticed the message about table inheritance I
> > thought that I would see if I could come up with a simple solution, and
> > have my first delve into the code for PostgreSQL.
> >
> > Attached is a diff against 7.3.3 source, of changes to describe.c for
> > psql. This should print out a list of parent tables in a similar style
> > to that of the index listing. I have done some testing on my side and it
> > all seems fine, can some other people have a quick look? What do people
> > think? Useful?
> Cool!! Thank you. But your patch can't be applyed to current CVS:
>
> % patch < ~/describe_inherits.diff
> Hmm...  Looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- describe.c Sat Dec 21 01:07:22 2002
> |+++ describe_inherits.c        Thu Jun 26 18:05:17 2003
> --------------------------
> Patching file describe.c using Plan A...
> Hunk #1 succeeded at 928 (offset -13 lines).
> Hunk #2 failed at 1021.
> Hunk #3 succeeded at 1159 with fuzz 1 (offset 7 lines).
> Hunk #4 succeeded at 1162 (offset -13 lines).
> 1 out of 4 hunks failed--saving rejects to describe.c.rej
>
>
>
> --
> Teodor Sigaev                                  E-mail: teodor@sigaev.ru
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073