Rose::DB::Pg(3pm)
β¨ Rose::DB::Pg β¨ (that's the Perl man page, bestie π )
okay so this is Rose::DB::Pg β the PostgreSQL driver class for Rose::DB, from the User Contributed Perl Documentation section of your man pages. sit down, grab a boba, we're gonna get you fluent in this π
πΈ SYNOPSIS πΈ
like, here's the vibe in code form:
use Rose::DB;
Rose::DB->register_db(
domain => 'development',
type => 'main',
driver => 'Pg',
database => 'dev_db',
host => 'localhost',
username => 'devuser',
password => 'mysecret',
server_time_zone => 'UTC',
european_dates => 1,
);
Rose::DB->default_domain('development');
Rose::DB->default_type('main');
...
$db = Rose::DB->new; # $db is really a Rose::DB::Pg-derived object
...
see how driver => 'Pg'?? that's the whole plot twist. keep reading πβ¨
π¦ DESCRIPTION π¦
so when the driver is "pg", Rose::DB blesses its objects into a class that's derived from Rose::DB::Pg. and the way driver names map to class names? fully configurable. go read the docs for Rose::DB's new() and driver_class() methods if you want the tea β
ngl, you cannot use this class directly, bestie. not a thing. you use Rose::DB and let its new() method hand you back an object blessed into whatever class is correct, based on its driver_class() mappings. it's giving matchmaker, honestly π
and here's the thing: only the methods that are new or behave differently from the ones in Rose::DB get documented on this page. for the full list of methods, go check the Rose::DB documentation. we're just covering the glow-ups here β¨
π CLASS METHODS π
timestamps_are_inlined [BOOL]β get or set a boolean that decides whether timestamp keywords should be inline. iftimestamps_are_inlinedis true, then keywords likeCURRENT_DATESTAMPandCURRENT_TIMESTAMPget inlined right into the generated SQL queries. default is false. no cap.
π OBJECT METHODS π
european_dates [BOOL]β get or set the boolean that decides whether dates are assumed to be in europeandd/mm/yyyyformat. the default is to assume USmm/dd/yyyy, because that's the default for PostgreSQL, periodt.
this value gets passed to DateTime::Format::Pg as the value of the "european" parameter in the call to the constructor new(). and this DateTime::Format::Pg object is what Rose::DB::Pg uses to parse and format date-related column values in methods like parse_date, format_date, etc. π«Ά
next_value_in_sequence SEQUENCEβ advance the sequence named SEQUENCE and return the new value. returnsundefif there was an error πserver_time_zone [TZ]β get or set the time zone used by the database server software. TZ should be a time zone name thatDateTime::TimeZoneunderstands. the default value is"floating".
this value gets passed to DateTime::Format::Pg as the value of the "server_tz" parameter in the call to the constructor new(). and this DateTime::Format::Pg object is what Rose::DB::Pg uses to parse and format date-related column values in methods like parse_date, format_date, etc.
for the acceptable values of TZ, go look at the DateTime::TimeZone documentation π
pg_enable_utf8 [BOOL]β get or set thepg_enable_utf8database handle attribute. this gets set directly on the dbh, if one exists. otherwise it'll be set when the dbh gets created. if no value for this attribute is defined (that's the default), then it won't be set when the dbh is created β instead it defers to whatever default valueDBD::Pgpicks π
it returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created.
go read the DBD::Pg documentation to learn more about this attribute π
sslmode [MODE]β get or set the SSL mode of the connection. valid values for MODE are"disable","allow","prefer", and"require". this attribute is used to build the DBI dsn. setting it has no effect until the next connection (yeah, fr fr, it's a "next time" situation π). see theDBD::Pgdocumentation to learn more about this attribute.
π Value Parsing and Formatting π
format_array ARRAYREF | LISTβ give it a reference to an array, or a list of values, and it returns a string formatted according to the rules of PostgreSQL's"ARRAY"column type.undefis returned if ARRAYREF points to an empty array, or if LIST isn't passed at all.format_interval DURATIONβ give it aDateTime::Durationobject and it returns a string formatted according to the rules of PostgreSQL's"INTERVAL"column type. but if DURATION is undefined, aDateTime::Durationobject, a valid interval keyword (according tovalidate_interval_keyword), or if it looks like a function call (matches"/^\w+\(.*\)$/") andkeyword_function_callsis true, then it gets returned unmodified. slay.parse_array STRINGβ parse STRING and return a reference to an array. STRING should be formatted according to PostgreSQL's"ARRAY"data type.undefis returned if STRING is undefined.parse_interval STRINGβ parse STRING and return aDateTime::Durationobject. STRING should be formatted according to the PostgreSQL native"interval"(years, months, days, hours, minutes, seconds) data type.
if STRING is a DateTime::Duration object, a valid interval keyword (according to validate_interval_keyword), or if it looks like a function call (matches "/^\w+\(.*\)$/") and keyword_function_calls is true, then it gets returned unmodified. otherwise, undef is returned if STRING couldn't be parsed as a valid "interval" value π
validate_date_keyword STRINGβ returns true if STRING is a valid keyword for the PostgreSQL"date"data type. the valid (case-insensitive) date keywords are:
current_date
epoch
now
now()
today
tomorrow
yesterday
the keywords are case sensitive. (yes ik the line above says case-insensitive, that's literally what the page says, don't come for me π) any string that looks like a function call (matches "/^\w+\(.*\)$/") is also considered a valid date keyword if keyword_function_calls is true.
validate_datetime_keyword STRINGβ returns true if STRING is a valid keyword for the PostgreSQL"datetime"data type, false otherwise. the valid (case-insensitive) datetime keywords are:
-infinity
allballs
current_date
current_time
current_time()
current_timestamp
current_timestamp()
epoch
infinity
localtime
localtime()
localtimestamp
localtimestamp()
now
now()
timeofday()
today
tomorrow
yesterday
the keywords are case sensitive. any string that looks like a function call (matches "/^\w+\(.*\)$/") is also considered a valid datetime keyword if keyword_function_calls is true.
validate_time_keyword STRINGβ returns true if STRING is a valid keyword for the PostgreSQL"time"data type, false otherwise. the valid (case-insensitive) timestamp keywords are:
allballs
current_time
current_time()
localtime
localtime()
now
now()
timeofday()
the keywords are case sensitive. any string that looks like a function call (matches "/^\w+\(.*\)$/") is also considered a valid timestamp keyword if keyword_function_calls is true.
validate_timestamp_keyword STRINGβ returns true if STRING is a valid keyword for the PostgreSQL"timestamp"data type, false otherwise. the valid (case-insensitive) timestamp keywords are:
-infinity
allballs
current_date
current_time
current_time()
current_timestamp
current_timestamp()
epoch
infinity
localtime
localtime()
localtimestamp
localtimestamp()
now
now()
timeofday()
today
tomorrow
yesterday
the keywords are case sensitive. any string that looks like a function call (matches "/^\w+\(.*\)$/") is also considered a valid timestamp keyword if keyword_function_calls is true.
π AUTHOR π
John C. Siracusa (siracusa@gmail.com) β king behaviour, honestly π
π LICENSE π
Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π«Ά this was Rose::DB::Pg(3pm) from the User Contributed Perl Documentation, built with perl v5.40.1 on 2026-07-31 β go forth and connect to your postgres db, you absolute icon π
β¨π
π¦ where this page comes from
- ubuntu stonking: librose-db-perl 0.788-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms