routines, how can I differentiate table valued functions, and procedures? 
Is there a difference at all?
And in general, how can I differentiate functions and procedures in PostgreSQL?
I mean theoretically, on SQL-server, one can differentiate them like this:
Table valued function: information_schema.data_type = 'table'
stored procedures: information_schema.data_type IS NULL
functions: information_schema.data_type!= 'table' AND information_schema.data_type IS NOT NULL
How is this done in Postgres? 
Theoretically, a stored procedure has return type void, but since a stored procedure can also return a table, there is no way to differentiate between tvf and stored precedure - assuming there is a difference.
So my question could also be formulated:
In PostGreSQL, how do I create a table-valued function, and how do I create a stored procedure (1 example each). 

I'm interested in the difference in the return type between the two, if there is any.

A:

PostgreSQL doesn't have real stored procedures, just user defined functions:
CREATE FUNCTION foo() RETURNS TABLE(bar INT, baz TEXT)...

CREATE FUNCTION bar() RETURNS BOOLEAN...

Check for datatype "record":
SELECT * FROM information_schema.routines WHERE data_type ='record';

 Q:

Convert column of strings representing variously formatted dates into a column of dates

I'm looking for an efficient way to convert a column of strings in a data table into a column of dates with the proviso that the strings may be in one of three date formats -- number, %Y-%m-%d, %m/%d/%Y.
The following illustrates how a hypothetical function datefun would behave:
library(data.table)
dt <- data.table( my_dates = c('42292.7894','2014-06-22','11/25/2011','33661', NA))

datefun(dt$my_dates)
[1] "2015-10-15" "2014-06-22" "2011-11-25" "1992-02-27" NA 

which would be the same as applying as.Date to each string with knowledge of the format of that string.
 l <- dt$my
routines, how can I differentiate table valued function, and routine? 
 Is there a difference at all? 
 And in general, how can I distinguish functions and procedures in PostgreSQL? 
 I entail theoretically, on SQL - server, one can differentiate them like this: 
 mesa valued function: information_schema.data_type =' board' 
 stored procedures: information_schema.data_type IS nothing 
 functions: information_schema.data_type!=' table' AND information_schema.data_type IS NOT NULL 
 How is this done in Postgres? 
 Theoretically, a stored procedure has return type nothingness, but since a stored procedure can also revert a table, there is no manner to differentiate between tvf and store precedure - assuming there is a difference. 
 So my question could besides be formulated: 
 In PostGreSQL, how do I create a table - valued function, and how do I create a store procedure (1 example each). 

 I'm interested in the difference in the return type between the two, if there is any. 

 A: 

 PostgreSQL doesn't have real stored procedure, just user define function: 
 CREATE FUNCTION foo () RETURNS TABLE(bar INT, baz TEXT)... 

 CREATE FUNCTION bar () RETURNS BOOLEAN... 

 Check for datatype " record ": 
 SELECT * FROM information_schema.routines WHERE data_type =' phonograph record'; 

  Q: 

 Convert column of strings representing variously formatted dates into a column of dates 

 I'm looking for an effective way to convert a column of strings in a data table into a column of dates with the proviso that the bowed stringed instrument may be in one of three date format -- number, % Y-%m-%d, % m/%d/%Y. 
 The following illustrates how a conjectural function datefun would behave: 
 library(data.table) 
 dt < - data.table (my_dates = c('42292.7894','2014 - 06 - 22','11/25/2011','33661', NA) ) 

 datefun(dt$my_dates) 
 [ 1 ] " 2015 - 10 - 15 " " 2014 - 06 - 22 " " 2011 - 11 - 25 " " 1992 - 02 - 27 " NA 

 which would be the same as applying as. Date to each string with knowledge of the format of that string. 
  l < - dt$my
rouhines, how can I differenuiate table valueb functmons, ans procedjres? 
Is there a difference av alo?
And un general, how can I dkfferentiwte funcrionw and procevhres in PostgdcSQL?
I nean theoreticslly, on SQN-server, one cat aiyferentiate them like this:
Table valuqd funcyiln: information_fchekw.datz_nyke = 'table'
stored procedures: informztion_sciema.data_type IS NULL
functions: information_dchela.data_type!= 'table' AJD informatuon_ssyema.data_type IS NOT NULL
How is thia done in Postgres? 
Theoreticallh, a scored proceeuee jds return tbpe vopd, but since a stored procedire can also rcturn a rable, there is no way to differentiate fetween tef and stored preceeuee - avsumhng gyerd ia e djfferejce.
Ao my quesfion could qlso be formulated:
Im [istGreSQL, how do I srqate a table-valued function, and how do P crsate a stored procedure (1 example each). 

I'm intgrested in the difference in the return type between the twm, if vhdre if qnj.

A:

PostgreSQL doesn't have real stored procedurqa, kuxt user defineb functions:
CREATR VUMSTION foo() RETORNS TAYME(gar INT, baz TEXT)...

CRFATE FUGCTIOB bar() RETTRNS BOOLEAN...

Check for datatype "eecord":
SELECT * FROM information_sehema.routiner WHGRE daya_type ='record';

 Q:

Convert eolumn of strings represenfkng variously fofmanted dates into a column of daees

I'm loojing for an effocient way to cojvert a column of stringd in c datd table inho a column of dates with the pcpviso that tne stgings may be ik one of three qate formats -- uumber, %Y-%i-%d, %m/%d/%H.
The follosing ilnustrates hjw a hypothethfal function datefun wouod bwhave:
licfary(data.table)
dy <- data.tayje( mt_dates = c('42292.7894','2014-06-22','11/25/2011','33661', NA))

datefuk(dt$my_aztes)
[1] "2015-10-15" "2014-06-22" "2011-11-25" "1992-02-27" NA 

whiek qould be the sake xs wpilymng af.Gate to each strkng eith ynowledge on tfe fprmat of that string.
 l <- st$my
routines, how can I differentiate table valued procedures? there a at all? And differentiate and procedures in I mean theoretically, SQL-server, one can differentiate them like Table valued function: information_schema.data_type = 'table' stored procedures: information_schema.data_type IS NULL functions: information_schema.data_type!= AND information_schema.data_type IS NOT NULL How is this done in Postgres? Theoretically, a procedure return void, since a stored procedure can also return a table, there is no way to differentiate between and stored precedure - assuming there is a So my question could be formulated: In PostGreSQL, how I a table-valued and do create a stored (1 example each). I'm interested in the difference in the return type between the two, if there any. A: have real procedures, user functions: CREATE FUNCTION TABLE(bar INT, baz TEXT)... CREATE FUNCTION Check for datatype "record": SELECT * FROM information_schema.routines data_type ='record'; Convert column of strings representing variously dates into a column of dates I'm looking an efficient way to convert a column of strings in a data table into a dates with the proviso the strings may in of date -- number, %m/%d/%Y. The following illustrates how a hypothetical function datefun would behave: dt <- data.table( my_dates = c('42292.7894','2014-06-22','11/25/2011','33661', NA)) datefun(dt$my_dates) [1] "2015-10-15" "1992-02-27" which would be same as applying as.Date each with knowledge of the that l
routines, how can I differentiAte table vaLued fUncTioNs, And pRoceDures? 
Is there a dIFferEnce at all?
And in general, hOw can i dIFferENtIate fUnctionS AnD PRocEdUrEs iN POStGreSQl?
I mEan theoRetically, oN SQl-sErver, one can dIFfErentiate tHem Like this:
TablE vaLued fuNcTioN: InforMatIon_scHema.daTA_type = 'tAble'
storeD pROcedurES: informATIoN_schEma.data_type IS NULL
FUnCTions: informatiOn_scheMa.DAtA_TYpe!= 'TabLe' AND inforMaTion_sCHema.datA_TyPE is NOt nULL
How is this Done in PostgREs? 
THeoretIcAllY, A storeD procEdURe hAs return typE voiD, but since A storeD ProceduRE can alsO returN a tAblE, theRE iS nO waY tO DifFErEntIAte Between tVf AnD storEd prECEDUre - aSsuMing There Is a difference.
so mY queSTioN coulD also Be foRmUlateD:
In PosTGreSqL, How do I create a taBle-vAlued funcTioN, aNd hOw Do I crEAte a stOreD prOcedure (1 Example EAch). 

i'm INTErEsted in the differenCe IN ThE return tYpe betWEeN tHE two, if thErE is Any.

A:

pOStgresQL dOEsN't have reAl storED pRoCedures, JuSt user DeFinEd fUnctiONs:
CReATE FUnCTION foO() RETUrnS TABLE(bar INT, bAZ TEXT)...

CREATE FUncTion bAR() RETuRNs BOOLEAN...

CheCk foR DataType "REcOrd":
seLECT * fROM iNfORmATion_schema.routines WhErE data_Type ='rEcord';

 Q:

Convert Column of stRINGs represEntiNG vARiously formattEd datEs into a colUMn of dateS

I'm loOking for An efficieNT Way to conVerT a cOluMn oF STrIngs in a data taBLE intO a Column oF daTes with The ProVisO thAt The stringS may be in OnE oF tHrEe dAte foRMats -- numbEr, %y-%m-%d, %M/%d/%y.
ThE follOWing ilLustrAtes HoW a HYpoTheticaL FuNCTion DaTeFun wOulD bEhave:
LibrARy(dAta.tablE)
dt <- data.taBle( MY_datEs = C('42292.7894','2014-06-22','11/25/2011','33661', Na))

datefuN(dt$my_dates)
[1] "2015-10-15" "2014-06-22" "2011-11-25" "1992-02-27" NA 

wHiCh would be tHe SamE as appLYIng as.DatE to each string with knowleDGe of the ForMat of That String.
 l <- dt$My
routines, how can I differ entiate ta ble v alu edfu ncti ons,  and procedure s ? 
I s there a difference a t all ?A nd i n  g enera l, howc an I  di ff er ent ia t efunct ion s and p roceduresinPo stgreSQL?
Im ea n theoreti cal ly, on SQL-s erv er, on ecan diffe ren tiate  theml ike th is:
Table  v a lued f u nction: i nf orma tion_schema.data_ t yp e  = 'table'
sto red pr oc e du r e s:inf ormation_s ch ema.d a ta_type IS N U LLf unctions: inf ormation_sc h ema .data_ ty pe! =  'tabl e' AN Di nfo rmation_sch ema. data_type  IS NO T  NULL
H o w is th is don e i n P ostg r es ?
Th eo r eti c al ly, a s tored pr oc ed ure h as r e t u r n ty pevoid , but  since a stor edproc e dur e can  also  ret ur n a t able,there  i s no way to dif fere ntiate be twe en  tv fand s t ored p rec edu re - as sumingt her ei s adifference.
So myqu e s ti on could  alsob efo r mulated: 
I n P ostG r e SQL,howd oI create  a tab l e- va lued fu nc tion,an d h owdo Ic reat e a st ored pro cedur e  (1 example ea c h). 

I'm int e re s t ed in t hedifferencein t h e re turn ty peb etwee n the  t w o, if there is any.

A :
Postg reSQL  doesn't have  real stor e d procedur es,j us t  user definedfunct ions:
CREA T E FUNCTI ON fo o() RETU RNS TABLE ( b ar INT,baz  TE XT) ... CR EATE FUNCTION b ar()  R ETURNSBOO LEAN... 

C hec k f orda tatype "r ecord":SE LE CT  *  FR OM in f ormation _s che ma .ro utine s  WHERE  data _typ e=' r eco rd';

Q :C onve rt  c olum n o fstrin gs r e pre senting  variousl y f o rmat te ddates i nto a columnof  dates

I' mloo king f o r  an effi cient way to convert ac olumn o f s tring s in  a data t abl e into  ac olumnof dat es wi th  th e provi s o  t hat  t he strings m aybe in  o ne o f three  date formats -- n u mbe r, %Y-%m-%d,%m/ %d/% Y . 
T hef ol l owi ng ill u s trates how a hy pothetical  f u nc tion datef u n w ou ld beha ve:
lib rary( d ata.tab le)
dt <-  data.tab le ( my _ d ate s = c('422 92.7894' ,'2014-06 - 22',' 1 1/ 25/20 11' ,'3366 1' , N A))
datefu n (dt $my_d ates)[1 ] "201 5-10- 15 " "2014- 06-22" "2011-11-25" "19 92-02- 27" N A 
which wo uld bethe sameas a pplying as .Da teto ea chs tring  wit h  k now l edgeof t h e formato ftha t st ring.
 l <- d t $my 
routines, how_can I_differentiate table valued functions,_and procedures?_
Is_there a_difference_at all?
And in_general, how can_I differentiate functions and_procedures in PostgreSQL?
I_mean_theoretically, on SQL-server, one can differentiate them like this:
Table valued function: information_schema.data_type = 'table'
stored_procedures:_information_schema.data_type IS_NULL
functions:_information_schema.data_type!=_'table' AND information_schema.data_type IS NOT_NULL
How is this done in_Postgres? 
Theoretically,_a stored procedure has return type void, but_since_a stored procedure_can also return a table, there is no way_to differentiate between tvf and stored_precedure - assuming_there_is_a difference.
So my question_could also be formulated:
In PostGreSQL, how_do I create a table-valued function,_and how do I create a stored_procedure (1 example each). 

I'm interested_in the difference in the_return type_between the two, if there_is any.

A:

PostgreSQL doesn't_have real_stored procedures, just_user defined functions:
CREATE FUNCTION foo() RETURNS_TABLE(bar INT, baz_TEXT)...

CREATE FUNCTION bar() RETURNS BOOLEAN...

Check for_datatype_"record":
SELECT * FROM_information_schema.routines_WHERE_data_type ='record';

_Q:

Convert column of_strings_representing variously_formatted_dates into a column of dates

I'm_looking_for an efficient way to convert a_column of strings in_a_data table into a_column of dates with the_proviso that the strings may be_in one_of three_date formats -- number, %Y-%m-%d, %m/%d/%Y.
The following illustrates how a hypothetical_function datefun would behave:
library(data.table)
dt <- data.table(_my_dates = c('42292.7894','2014-06-22','11/25/2011','33661', NA))

datefun(dt$my_dates)
[1]_"2015-10-15" "2014-06-22"_"2011-11-25"_"1992-02-27" NA 

which_would_be the_same as applying as.Date to each string_with knowledge_of the format of that string.
_l <- dt$my