Обсуждение: little patch for "Detect serial columns from pg_depend" and bugfix
Hi, Please find the attachments. pgColumn.patch: Detect serial columns from pg_depend, not column default (observe deviating serial name) pgSequence.patch: bugfix, in SQL pane of the sequence, the script is CREATE SEQUENCE xxx ...; ALTER TABLE ... Regards, Quan Zongliang
Вложения
Hi
On Tue, Sep 4, 2012 at 5:03 AM, Quan Zongliang <quanzongliang@gmail.com> wrote:
> Hi,
>
> Please find the attachments.
>
> pgColumn.patch:
>
> Detect serial columns from pg_depend, not column default (observe deviating
> serial name)
This patch does not apply:
raptor:pgAdmin3 dpage$ git apply ~/Downloads/pgColumn.patch
/Users/dpage/Downloads/pgColumn.patch:13: trailing whitespace.
pgSet *set = ExecuteSet(
/Users/dpage/Downloads/pgColumn.patch:14: trailing whitespace.
wxT("SELECT classid\n")
/Users/dpage/Downloads/pgColumn.patch:15: trailing whitespace.
wxT(" FROM pg_depend\n")
/Users/dpage/Downloads/pgColumn.patch:16: trailing whitespace.
wxT(" WHERE refobjid=") + table->GetOidStr() +
/Users/dpage/Downloads/pgColumn.patch:17: trailing whitespace.
wxT(" AND refobjsubid = ") + NumToStr(GetColNumber()) +
error: patch failed: pgadmin/schema/pgColumn.cpp:338
error: pgadmin/schema/pgColumn.cpp: patch does not apply
> pgSequence.patch:
>
> bugfix, in SQL pane of the sequence, the script is
>
> CREATE SEQUENCE xxx
> ...;
> ALTER TABLE ...
That syntax is intentional - it's required with 8.3 and earlier, which
don't support ALTER SEQUENCE ... OWNER. I suppose we could make it
version dependent, but we don't normally both with multiple versions
of the same command unless required.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On 2012/9/4 19:02, Dave Page wrote:
> Hi
>
> On Tue, Sep 4, 2012 at 5:03 AM, Quan Zongliang <quanzongliang@gmail.com> wrote:
>> Hi,
>>
>> Please find the attachments.
>>
>> pgColumn.patch:
>>
>> Detect serial columns from pg_depend, not column default (observe deviating
>> serial name)
> This patch does not apply:
>
> raptor:pgAdmin3 dpage$ git apply ~/Downloads/pgColumn.patch
> /Users/dpage/Downloads/pgColumn.patch:13: trailing whitespace.
> pgSet *set = ExecuteSet(
> /Users/dpage/Downloads/pgColumn.patch:14: trailing whitespace.
> wxT("SELECT classid\n")
> /Users/dpage/Downloads/pgColumn.patch:15: trailing whitespace.
> wxT(" FROM pg_depend\n")
> /Users/dpage/Downloads/pgColumn.patch:16: trailing whitespace.
> wxT(" WHERE refobjid=") + table->GetOidStr() +
> /Users/dpage/Downloads/pgColumn.patch:17: trailing whitespace.
> wxT(" AND refobjsubid = ") + NumToStr(GetColNumber()) +
> error: patch failed: pgadmin/schema/pgColumn.cpp:338
> error: pgadmin/schema/pgColumn.cpp: patch does not apply
new patch attched.
I tested it under Cygwin, seems OK.
>> pgSequence.patch:
>>
>> bugfix, in SQL pane of the sequence, the script is
>>
>> CREATE SEQUENCE xxx
>> ...;
>> ALTER TABLE ...
> That syntax is intentional - it's required with 8.3 and earlier, which
> don't support ALTER SEQUENCE ... OWNER. I suppose we could make it
> version dependent, but we don't normally both with multiple versions
> of the same command unless required.
>
Вложения
On Wed, Sep 5, 2012 at 3:39 AM, Quan Zongliang <quanzongliang@gmail.com> wrote:
>
> new patch attched.
> I tested it under Cygwin, seems OK.
I got an error on my first test I'm afraid :-(
2012-09-05 14:39:41 QUERY : Set query (localhost:5432): SELECT classid
FROM pg_depend
WHERE refobjid=207478::oid AND refobjsubid = 1 AND objid IN
('pem.agent_id_seq'::regclass,'"pem.agent_id_seq"'::regclass) AND
deptype='a'
2012-09-05 14:39:41 ERROR : ERROR: relation "pem.agent_id_seq" does not exist
LINE 3: ...id = 1 AND objid IN ('pem.agent_id_seq'::regclass,'"pem.agen...
How does the attached version of the patch look? I've tweaked the
formatting and removed the excess quotes that seemed to be causing the
issue.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Вложения
2012/9/5 Dave Page <dpage@pgadmin.org>
On Wed, Sep 5, 2012 at 3:39 AM, Quan Zongliang <quanzongliang@gmail.com> wrote:I got an error on my first test I'm afraid :-(
>
> new patch attched.
> I tested it under Cygwin, seems OK.
2012-09-05 14:39:41 QUERY : Set query (localhost:5432): SELECT classid
FROM pg_depend
WHERE refobjid=207478::oid AND refobjsubid = 1 AND objid IN
('pem.agent_id_seq'::regclass,'"pem.agent_id_seq"'::regclass) AND
deptype='a'
2012-09-05 14:39:41 ERROR : ERROR: relation "pem.agent_id_seq" does not exist
LINE 3: ...id = 1 AND objid IN ('pem.agent_id_seq'::regclass,'"pem.agen...
How does the attached version of the patch look? I've tweaked the
formatting and removed the excess quotes that seemed to be causing the
issue.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
There is a bug in original source.
I will try to fix it tomorrow.
When a column is given a special name.
The serial type can not be reversed correctly.
defination: "c 2" bigserial
display in pgAdmin: "c 2" bigint NOT NULL DEFAULT nextval('pem."t1_c 2_seq"'::regclass)
Because pgAdmin check columns which default value has 'pem.t1_c 2_seq'::regclass
and '"pem.t1_c 2_seq"'::regclass. But second one should be 'pem."t1_c 2_seq"'::regclass
Quan Zongliang
On 2012/9/5 22:48, 权宗亮 wrote:
>
>
> 2012/9/5 Dave Page <dpage@pgadmin.org <mailto:dpage@pgadmin.org>>
>
> On Wed, Sep 5, 2012 at 3:39 AM, Quan Zongliang
> <quanzongliang@gmail.com <mailto:quanzongliang@gmail.com>> wrote:
> >
> > new patch attched.
> > I tested it under Cygwin, seems OK.
>
> I got an error on my first test I'm afraid :-(
>
> 2012-09-05 14:39:41 QUERY : Set query (localhost:5432): SELECT classid
> FROM pg_depend
> WHERE refobjid=207478::oid AND refobjsubid = 1 AND objid IN
> ('pem.agent_id_seq'::regclass,'"pem.agent_id_seq"'::regclass) AND
> deptype='a'
> 2012-09-05 14:39:41 ERROR : ERROR: relation "pem.agent_id_seq"
> does not exist
> LINE 3: ...id = 1 AND objid IN
> ('pem.agent_id_seq'::regclass,'"pem.agen...
>
> How does the attached version of the patch look? I've tweaked the
> formatting and removed the excess quotes that seemed to be causing the
> issue.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> There is a bug in original source.
> I will try to fix it tomorrow.
>
> When a column is given a special name.
> The serial type can not be reversed correctly.
>
> defination: "c 2" bigserial
> display in pgAdmin: "c 2" bigint NOT NULL DEFAULT nextval('pem."t1_c
> 2_seq"'::regclass)
>
> Because pgAdmin check columns which default value has 'pem.t1_c
> 2_seq'::regclass
> and '"pem.t1_c 2_seq"'::regclass. But second one should be 'pem."t1_c
> 2_seq"'::regclass
>
> Quan Zongliang
Try this.
Only fixed for 8.1 and above.
Вложения
On Thu, Sep 6, 2012 at 1:56 AM, Quan Zongliang <quanzongliang@gmail.com> wrote:
> On 2012/9/5 22:48, 权宗亮 wrote:
>>
>>
>>
>> 2012/9/5 Dave Page <dpage@pgadmin.org <mailto:dpage@pgadmin.org>>
>>
>>
>> On Wed, Sep 5, 2012 at 3:39 AM, Quan Zongliang
>> <quanzongliang@gmail.com <mailto:quanzongliang@gmail.com>> wrote:
>> >
>> > new patch attched.
>> > I tested it under Cygwin, seems OK.
>>
>> I got an error on my first test I'm afraid :-(
>>
>> 2012-09-05 14:39:41 QUERY : Set query (localhost:5432): SELECT classid
>> FROM pg_depend
>> WHERE refobjid=207478::oid AND refobjsubid = 1 AND objid IN
>> ('pem.agent_id_seq'::regclass,'"pem.agent_id_seq"'::regclass) AND
>> deptype='a'
>> 2012-09-05 14:39:41 ERROR : ERROR: relation "pem.agent_id_seq"
>> does not exist
>> LINE 3: ...id = 1 AND objid IN
>> ('pem.agent_id_seq'::regclass,'"pem.agen...
>>
>> How does the attached version of the patch look? I've tweaked the
>> formatting and removed the excess quotes that seemed to be causing the
>> issue.
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> There is a bug in original source.
>> I will try to fix it tomorrow.
>>
>> When a column is given a special name.
>> The serial type can not be reversed correctly.
>>
>> defination: "c 2" bigserial
>> display in pgAdmin: "c 2" bigint NOT NULL DEFAULT nextval('pem."t1_c
>> 2_seq"'::regclass)
>>
>> Because pgAdmin check columns which default value has 'pem.t1_c
>> 2_seq'::regclass
>> and '"pem.t1_c 2_seq"'::regclass. But second one should be 'pem."t1_c
>> 2_seq"'::regclass
>>
>> Quan Zongliang
>
>
> Try this.
> Only fixed for 8.1 and above.
Thanks, patch applied.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company