-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start including database parameters in inspect results
- Loading branch information
Showing
6 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
|
||
parameters { | ||
search_path = ["$user", "public"] | ||
timezone = "" | ||
} | ||
|
||
schema "public" { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package pg | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/sjansen/pgutil/internal/ddl" | ||
) | ||
|
||
// ListParameters describes database configuration parameters | ||
func (c *Conn) ListParameters() (*ddl.Parameters, error) { | ||
c.log.Infow("listing parameters") | ||
|
||
params := &ddl.Parameters{} | ||
|
||
var tmp string | ||
c.log.Debugw("SHOW search_path") | ||
row := c.conn.QueryRow("SHOW search_path") | ||
err := row.Scan(&tmp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
params.SearchPath = strings.Split(tmp, ",") | ||
|
||
c.log.Debugw("SHOW timezone") | ||
row = c.conn.QueryRow("SHOW timezone") | ||
err = row.Scan(¶ms.Timezone) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return params, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters