postgresql-11

Postgres timestamp with microseconds

拜拜、爱过 提交于 2021-02-11 12:18:28
问题 I have a column in a table with datatype set as timestamp without time zone . I need the time part with microseconds(6 digits), but sometimes if the last digit is zero, the microseconds part ignores it. I am able to query it with the below query to get 6 digits select to_char(now(), 'yyyy-mm-dd hh:mi:us'); 2020-07-16 12:05:598000 The above output is in text/char format but I need it in timestamp without time zone datatype with all 6 digits for microseconds even if one or some of the last

Execute a Bash script (Shell Script) from postgres function/procedure/trigger

*爱你&永不变心* 提交于 2021-02-09 08:11:00
问题 CREATE or replace FUNCTION test() RETURNS boolean AS $$ $filename = '/home/postgres'; if (-e $filename) { exec /home/postgres/test.sh & return true; } return false; $$ LANGUAGE plperlu; exec /home/postgres/test.sh & its showing syntax error. Could you please help how to call bash script into postgres funtion/procedure 回答1: Presumably, the code needs to be syntactically valid Perl. So you'll need to clean up a few bits. CREATE or replace FUNCTION test() RETURNS boolean AS $$ my $filename = '

Execute a Bash script (Shell Script) from postgres function/procedure/trigger

送分小仙女□ 提交于 2021-02-09 08:08:13
问题 CREATE or replace FUNCTION test() RETURNS boolean AS $$ $filename = '/home/postgres'; if (-e $filename) { exec /home/postgres/test.sh & return true; } return false; $$ LANGUAGE plperlu; exec /home/postgres/test.sh & its showing syntax error. Could you please help how to call bash script into postgres funtion/procedure 回答1: Presumably, the code needs to be syntactically valid Perl. So you'll need to clean up a few bits. CREATE or replace FUNCTION test() RETURNS boolean AS $$ my $filename = '

Execute a Bash script (Shell Script) from postgres function/procedure/trigger

半腔热情 提交于 2021-02-09 08:06:59
问题 CREATE or replace FUNCTION test() RETURNS boolean AS $$ $filename = '/home/postgres'; if (-e $filename) { exec /home/postgres/test.sh & return true; } return false; $$ LANGUAGE plperlu; exec /home/postgres/test.sh & its showing syntax error. Could you please help how to call bash script into postgres funtion/procedure 回答1: Presumably, the code needs to be syntactically valid Perl. So you'll need to clean up a few bits. CREATE or replace FUNCTION test() RETURNS boolean AS $$ my $filename = '

How to pass a Type as an input variable to a inner function which is called in a function

。_饼干妹妹 提交于 2021-01-29 14:16:35
问题 Tried the following to pass the TYPE variable 'clientBdrIds 'as input parameter to an function'SP_GetDat' using unnest .Not working. Please help me by suggesting a way to pass the TYPE variable as input to a function which is called by the function 'Sp_GetFimBdrRiskData'. CREATE OR REPLACE FUNCTION Sp_GetFimBdrRiskData(clientBdrIds CL_Numeric[]) returns void AS $$ BEGIN create temporary table tt_RISKVALUES as SELECT * FROM SP_GetDat(**select * from unnest (clientBdrIds)**);//type variable as

How to call the Postgres V11 Stored Procedures(not function) with InOut parameter as RefCursor? using Npgsql v4.0.8

*爱你&永不变心* 提交于 2021-01-29 08:34:43
问题 I am trying to call the postgresql v11 store procedure (not function) with InOut parameter as RefCursor? using Npgsql v4.0.8 from ado.net code 4.5 framework. but not able to read the data from it. even have tried using Npgsql v4.1.2(latest version) from ado.net code 4.6.1 framework also but still then not able to read the data from store procedure. what is the solution? for it. please provide sample code to fetch the value. my sample code: public void PopulateTableFromCursor() {

How to get result set from PostgreSQL stored procedure?

非 Y 不嫁゛ 提交于 2020-07-08 19:29:24
问题 I created a stored procedure in PostgreSQL 11 to perform CRUD operation, and it works fine for 1. Create 2. Update 3. Delete, but while I run read command by passing Condition = 4 to select a result set, I get below error. I have used PostgreSQL function to get result set it works for me, but I need to get result using the PostgreSQL stored procedure. Here is my code for stored procedure: CREATE OR REPLACE PROCEDURE public.testSpCrud( fnam text, lnam text, id integer, condition integer)

How to get result set from PostgreSQL stored procedure?

喜你入骨 提交于 2020-07-08 19:28:33
问题 I created a stored procedure in PostgreSQL 11 to perform CRUD operation, and it works fine for 1. Create 2. Update 3. Delete, but while I run read command by passing Condition = 4 to select a result set, I get below error. I have used PostgreSQL function to get result set it works for me, but I need to get result using the PostgreSQL stored procedure. Here is my code for stored procedure: CREATE OR REPLACE PROCEDURE public.testSpCrud( fnam text, lnam text, id integer, condition integer)

Win 10 Postgresql 11 database cluster initialisation failed

放肆的年华 提交于 2020-06-24 10:07:47
问题 i got a new laptop from Dell(XPS 15), with Windows 10 Pro. I have always the same issue During installation of postgres "Problem running post-install step. Installation may not complete correctly. The Database cluster initialisation failed." . i tried a lot of solutions of past threads: Install postgres not into progam files create a user named postgres with full access to postgress directory, explained here https://www.youtube.com/watch?v=pS_zWDDDSe0 Checked for new win-updates Turned off