Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Sympa
Commits
baed879a
Commit
baed879a
authored
May 15, 2021
by
IKEDA Soji
Browse files
PostgreSQL: Add a view "dual" to make some SQL statements portable.
parent
27b86fa1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/Sympa/DatabaseDriver/PostgreSQL.pm
View file @
baed879a
...
...
@@ -61,11 +61,19 @@ sub connect {
# - Configure Postgres to use ISO format dates.
# - Set client encoding to UTF8.
# - Create a temporary view "dual" for portable SQL statements.
# Note: utf8 flagging must be disabled so that we will consistently use
# UTF-8 bytestring as internal format.
# UTF-8 bytestring as internal format.
# Note: PostgreSQL <= 8.0.x didn't support temporary view but >= 7.3.x
# supported CREATE OR REPLACE statement.
$self
->
__dbh
->
{
pg_enable_utf8
}
=
0
;
# For DBD::Pg 3.x
$self
->
__dbh
->
do
("
SET DATESTYLE TO 'ISO';
");
$self
->
__dbh
->
do
("
SET NAMES 'utf8'
");
defined
$self
->
__dbh
->
do
(
q{CREATE TEMPORARY VIEW dual AS SELECT 'X'::varchar(1) AS dummy;}
)
or
$self
->
__dbh
->
do
(
q{CREATE OR REPLACE VIEW dual AS SELECT 'X'::varchar(1) AS dummy;}
);
return
1
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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