Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
e6a64bd3
Commit
e6a64bd3
authored
May 13, 2008
by
Alvaro Herrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug in the previous patch, which caused the title pointer to be used
before it was actually set.
parent
1e9199e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
42 deletions
+44
-42
src/bin/psql/describe.c
src/bin/psql/describe.c
+40
-40
src/bin/psql/print.c
src/bin/psql/print.c
+4
-2
No files found.
src/bin/psql/describe.c
View file @
e6a64bd3
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.17
1 2008/05/12 22:59:58
alvherre Exp $
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.17
2 2008/05/13 00:14:11
alvherre Exp $
*/
*/
#include "postgres_fe.h"
#include "postgres_fe.h"
...
@@ -865,6 +865,45 @@ describeOneTableDetails(const char *schemaname,
...
@@ -865,6 +865,45 @@ describeOneTableDetails(const char *schemaname,
goto
error_return
;
goto
error_return
;
numrows
=
PQntuples
(
res
);
numrows
=
PQntuples
(
res
);
/* Make title */
switch
(
tableinfo
.
relkind
)
{
case
'r'
:
printfPQExpBuffer
(
&
title
,
_
(
"Table
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'v'
:
printfPQExpBuffer
(
&
title
,
_
(
"View
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'S'
:
printfPQExpBuffer
(
&
title
,
_
(
"Sequence
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'i'
:
printfPQExpBuffer
(
&
title
,
_
(
"Index
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
's'
:
/* not used as of 8.2, but keep it for backwards compatibility */
printfPQExpBuffer
(
&
title
,
_
(
"Special relation
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
't'
:
printfPQExpBuffer
(
&
title
,
_
(
"TOAST table
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'c'
:
printfPQExpBuffer
(
&
title
,
_
(
"Composite type
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
default:
/* untranslated unknown relkind */
printfPQExpBuffer
(
&
title
,
"?%c?
\"
%s.%s
\"
"
,
tableinfo
.
relkind
,
schemaname
,
relationname
);
break
;
}
/* Set the number of columns, and their names */
/* Set the number of columns, and their names */
cols
=
2
;
cols
=
2
;
headers
[
0
]
=
"Column"
;
headers
[
0
]
=
"Column"
;
...
@@ -937,45 +976,6 @@ describeOneTableDetails(const char *schemaname,
...
@@ -937,45 +976,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddCell
(
&
cont
,
PQgetvalue
(
res
,
i
,
5
),
false
);
printTableAddCell
(
&
cont
,
PQgetvalue
(
res
,
i
,
5
),
false
);
}
}
/* Make title */
switch
(
tableinfo
.
relkind
)
{
case
'r'
:
printfPQExpBuffer
(
&
title
,
_
(
"Table
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'v'
:
printfPQExpBuffer
(
&
title
,
_
(
"View
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'S'
:
printfPQExpBuffer
(
&
title
,
_
(
"Sequence
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'i'
:
printfPQExpBuffer
(
&
title
,
_
(
"Index
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
's'
:
/* not used as of 8.2, but keep it for backwards compatibility */
printfPQExpBuffer
(
&
title
,
_
(
"Special relation
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
't'
:
printfPQExpBuffer
(
&
title
,
_
(
"TOAST table
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
case
'c'
:
printfPQExpBuffer
(
&
title
,
_
(
"Composite type
\"
%s.%s
\"
"
),
schemaname
,
relationname
);
break
;
default:
/* untranslated unknown relkind */
printfPQExpBuffer
(
&
title
,
"?%c?
\"
%s.%s
\"
"
,
tableinfo
.
relkind
,
schemaname
,
relationname
);
break
;
}
/* Make footers */
/* Make footers */
if
(
tableinfo
.
relkind
==
'i'
)
if
(
tableinfo
.
relkind
==
'i'
)
{
{
...
...
src/bin/psql/print.c
View file @
e6a64bd3
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.10
0 2008/05/12 22:59:58
alvherre Exp $
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.10
1 2008/05/13 00:14:11
alvherre Exp $
*/
*/
#include "postgres_fe.h"
#include "postgres_fe.h"
...
@@ -1918,8 +1918,10 @@ ClosePager(FILE *pagerpipe)
...
@@ -1918,8 +1918,10 @@ ClosePager(FILE *pagerpipe)
/*
/*
* Initialise a table contents struct.
* Initialise a table contents struct.
* Must be called before any other printTable method is used.
*
*
* Must be called before any other printTable method is used.
* The title is not duplicated; the caller must ensure that the buffer
* is available for the lifetime of the printTableContent struct.
*
*
* If you call this, you must call printTableCleanup once you're done with the
* If you call this, you must call printTableCleanup once you're done with the
* table.
* table.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment