8000 Provide for forward compatibility with future minor protocol versions. · koderP/postgres@c703aa6 · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script type="application/json" data-target="react-app.embeddedData">{"payload":{"commit":{"oid":"c703aa6258997d22ca7338bc221c31ff83feefb7","url":"/koderP/postgres/commit/c703aa6258997d22ca7338bc221c31ff83feefb7","authoredDate":"2017-11-21T13:56:24.000-05:00","committedDate":"2017-11-21T14:34:26.000-05:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eProvide for forward compatibility with future minor protocol versions.\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"Previously, any attempt to request a 3.x protocol version other than\n3.0 would lead to a hard connection failure, which made the minor\nprotocol version really no different from the major protocol version\nand precluded gentle protocol version breaks. Instead, when the\nclient requests a 3.x protocol version where x is greater than 0, send\nthe new NegotiateProtocolVersion message to convey that we support\nonly 3.0. This makes it possible to introduce new minor protocol\nversions without requiring a connection retry when the server is\nolder.\n\nIn addition, if the startup packet includes name/value pairs where\nthe name starts with \"_pq_.\", assume that those are protocol options,\nnot GUCs. Include those we don't support (i.e. all of them, at\npresent) in the NegotiateProtocolVersion message so that the client\nknows they were not understood. This makes it possible for the\nclient to request previously-unsupported features without bumping\nthe protocol version at all; the client can tell from the server's\nresponse whether the option was understood.\n\nIt will take some time before servers that support these new\nfacilities become common in the wild; to speed things up and make\nthings easier for a future 3.1 protocol version, back-patch to all\nsupported releases.\n\nRobert Haas and Badrul Chowdhury\n\nDiscussion: \u003ca href=\"http://postgr.es/m/BN6PR21MB0772FFA0CBD298B76017744CD1730@BN6PR21MB0772.namprd21.prod.outlook.com\" rel=\"nofollow\"\u003ehttp://postgr.es/m/BN6PR21MB0772FFA0CBD298B76017744CD1730@BN6PR21MB0772.namprd21.prod.outlook.com\u003c/a\u003e\nDiscussion: \u003ca href=\"http://postgr.es/m/30788.1498672033@sss.pgh.pa.us\" rel=\"nofollow\"\u003ehttp://postgr.es/m/30788.1498672033@sss.pgh.pa.us\u003c/a\u003e","authors":[{"login":"robertmhaas","displayName":"Robert Haas","avatarUrl":"https://avatars.githubusercontent.com/u/886678?v=4","path":"/robertmhaas","isGitHub":false}],"committerAttribution":false,"committer":{"login":"robertmhaas","displayName":"Robert Haas","avatarUrl":"https://avatars.githubusercontent.com/u/886678?v=4","path":"/robertmhaas","isGitHub":false},"parents":["2cfafabe64bae2d7923ab9863786d7bcc7cdf793"],"globalRelayId":"MDY6Q29tbWl0MTEyMjQ4NzQ3OmM3MDNhYTYyNTg5OTdkMjJjYTczMzhiYzIyMWMzMWZmODNmZWVmYjc=","sha1":"2cfafabe64bae2d7923ab9863786d7bcc7cdf793","sha2":"c703aa6258997d22ca7338bc221c31ff83feefb7"},"currentUser":null,"repo":{"id":112248747,"defaultBranch":"master","name":"postgres","ownerLogin":"koderP","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2017-11-27T21:07:21.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/18019035?v=4","public":true,"private":false,"isOrgOwned":false},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":21,"text":"@@ -22,10 +22,18 @@","html":"@@ -22,10 +22,18 @@","displayNoNewLineWarning":false,"position":0,"left":21,"right":21},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":22,"text":" \u003cproductname\u003ePostgreSQL\u003c/productname\u003e 7.4 and later. For descriptions","html":" \u0026lt;productname\u0026gt;PostgreSQL\u0026lt;/productname\u0026gt; 7.4 and later. For descriptions","displayNoNewLineWarning":false,"position":1,"left":22,"right":22},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":23,"text":" of the earlier protocol versions, see previous releases of the","html":" of the earlier protocol versions, see previous releases of the","displayNoNewLineWarning":false,"position":2,"left":23,"right":23},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":24,"text":" \u003cproductname\u003ePostgreSQL\u003c/productname\u003e documentation. A single server","html":" \u0026lt;productname\u0026gt;PostgreSQL\u0026lt;/productname\u0026gt; documentation. A single server","displayNoNewLineWarning":false,"position":3,"left":24,"right":24},{"stylingDirective":null,"type":"DELETION","blobLineNumber":25,"text":"- can support multiple protocol versions. The initial","html":"- can support multiple protocol versions. The initial","displayNoNewLineWarning":false,"position":4,"left":25,"right":24},{"stylingDirective":null,"type":"DELETION","blobLineNumber":26,"text":"- startup-request message tells the server which protocol version the","html":"- startup-request message tells the server which protocol version the","displayNoNewLineWarning":false,"position":5,"left":26,"right":24},{"stylingDirective":null,"type":"DELETION","blobLineNumber":27,"text":"- client is attempting to use, and then the server follows that protocol","html":"- client is attempting to use, and then the server follows that protocol","displayNoNewLineWarning":false,"position":6,"left":27,"right":24},{"stylingDirective":null,"type":"DELETION","blobLineNumber":28,"text":"- if it is able.","html":"- if it is able.","displayNoNewLineWarning":false,"position":7,"left":28,"right":24},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":25,"text":"+ can support multiple protocol versions. The initial startup-request","html":"+ can support multiple protocol versions. The initial startup-request","displayNoNewLineWarning":false,"position":8,"left":28,"right":25},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":26,"text":"+ message tells the server which protocol version the client is attempting to","html":"+ message tells the server which protocol version the client is attempting to","displayNoNewLineWarning":false,"position":9,"left":28,"right":26},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":27,"text":"+ use. If the major version requested by the client is not supported by","html":"+ use. If the major version requested by the client is not supported by","displayNoNewLineWarning":false,"position":10,"left":28,"right":27},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":28,"text":"+ the server, the connection will be rejected (for example, this would occur","html":"+ the server, the connection will be rejected (for example, this would occur","displayNoNewLineWarning":false,"position":11,"left":28,"right":28},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":29,"text":"+ if the client requested protocol version 4.0, which does not exist as of","html":"+ if the client requested protocol version 4.0, which does not exist as of","displayNoNewLineWarning":false,"position":12,"left":28,"right":29},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":30,"text":"+ this writing). If the minor version requested by the client is not","html":"+ this writing). If the minor version requested by the client is not","displayNoNewLineWarning":false,"position":13,"left":28,"right":30},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":31,"text":"+ supported by the server (e.g. the client requests version 3.1, but the","html":"+ supported by the server (e.g. the client requests version 3.1, but the","displayNoNewLineWarning":false,"position":14,"left":28,"right":31},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":32,"text":"+ server supports only 3.0), the server may either reject the connection or","html":"+ server supports only 3.0), the server may either reject the connection or","displayNoNewLineWarning":false,"position":15,"left":28,"right":32},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":33,"text":"+ may respond with a NegotiateProtocolVersion message containing the highest","html":"+ may respond with a NegotiateProtocolVersion message containing the highest","displayNoNewLineWarning":false,"position":16,"left":28,"right":33},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":34,"text":"+ minor protocol version which it supports. The client may then choose either","html":"+ minor protocol version which it supports. The client may then choose either","displayNoNewLineWarning":false,"position":17,"left":28,"right":34},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":35,"text":"+ to continue with the connection using the specified protocol version or","html":"+ to continue with the connection using the specified protocol version or","displayNoNewLineWarning":false,"position":18,"left":28,"right":35},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":36,"text":"+ to abort the connection.","html":"+ to abort the connection.","displayNoNewLineWarning":false,"position":19,"left":28,"right":36},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":37,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":20,"left":29,"right":37},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":38,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":21,"left":30,"right":38},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":39,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":22,"left":31,"right":39},{"stylingDirective":null,"type":"HUNK","blobLineNumber":373,"text":"@@ -366,6 +374,20 @@","html":"@@ -366,6 +374,20 @@","displayNoNewLineWarning":false,"position":23,"left":365,"right":373},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":374,"text":" \u003c/listitem\u003e","html":" \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":24,"left":366,"right":374},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":375,"text":" \u003c/varlistentry\u003e","html":" \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":25,"left":367,"right":375},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":376,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":26,"left":368,"right":376},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":377,"text":"+ \u003cvarlistentry\u003e","html":"+ \u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":27,"left":368,"right":377},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":378,"text":"+ \u003cterm\u003eNegotiateProtocolVersion\u003c/term\u003e","html":"+ \u0026lt;term\u0026gt;NegotiateProtocolVersion\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":28,"left":368,"right":378},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":379,"text":"+ \u003clistitem\u003e","html":"+ \u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":29,"left":368,"right":379},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":380,"text":"+ \u003cpara\u003e","html":"+ \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":30,"left":368,"right":380},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":381,"text":"+ The server does not support the minor protocol version requested","html":"+ The server does not support the minor protocol version requested","displayNoNewLineWarning":false,"position":31,"left":368,"right":381},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":382,"text":"+ by the client, but does support an earlier version of the protocol;","html":"+ by the client, but does support an earlier version of the protocol;","displayNoNewLineWarning":false,"position":32,"left":368,"right":382},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":383,"text":"+ this message indicates the highest supported minor version. This","html":"+ this message indicates the highest supported minor version. This","displayNoNewLineWarning":false,"position":33,"left":368,"right":383},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":384,"text":"+ message will also be sent if the client requested unsupported protocol","html":"+ message will also be sent if the client requested unsupported protocol","displayNoNewLineWarning":false,"position":34,"left":368,"right":384},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":385,"text":"+ options (i.e. beginning with \u003cliteral\u003e_pq_.\u003c/literal\u003e) in the","html":"+ options (i.e. beginning with \u0026lt;literal\u0026gt;_pq_.\u0026lt;/literal\u0026gt;) in the","displayNoNewLineWarning":false,"position":35,"left":368,"right":385},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":386,"text":"+ startup packet. This message will be followed by an ErrorResponse or","html":"+ startup packet. This message will be followed by an ErrorResponse or","displayNoNewLineWarning":false,"position":36,"left":368,"right":386},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":387,"text":"+ a message indicating the success or failure of authentication.","html":"+ a message indicating the success or failure of authentication.","displayNoNewLineWarning":false,"position":37,"left":368,"right":387},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":388,"text":"+ \u003c/para\u003e","html":"+ \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":38,"left":368,"right":388},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":389,"text":"+ \u003c/listitem\u003e","html":"+ \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":39,"left":368,"right":389},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":390,"text":"+ \u003c/varlistentry\u003e","html":"+ \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":40,"left":368,"right":390},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":391,"text":" \u003c/variablelist\u003e","html":" \u0026lt;/variablelist\u0026gt;","displayNoNewLineWarning":false,"position":41,"left":369,"right":391},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":392,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":42,"left":370,"right":392},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":393,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":43,"left":371,"right":393},{"stylingDirective":null,"type":"HUNK","blobLineNumber":401,"text":"@@ -380,8 +402,10 @@","html":"@@ -380,8 +402,10 @@","displayNoNewLineWarning":false,"position":44,"left":379,"right":401},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":402,"text":" for further messages from the server. In this phase a backend process","html":" for further messages from the server. In this phase a backend process","displayNoNewLineWarning":false,"position":45,"left":380,"right":402},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":403,"text":" is being started, and the frontend is just an interested bystander.","html":" is being started, and the frontend is just an interested bystander.","displayNoNewLineWarning":false,"position":46,"left":381,"right":403},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":404,"text":" It is still possible for the startup attempt","html":" It is still possible for the startup attempt","displayNoNewLineWarning":false,"position":47,"left":382,"right":404},{"stylingDirective":null,"type":"DELETION","blobLineNumber":383,"text":"- to fail (ErrorResponse), but in the normal case the backend will send","html":"- to fail (ErrorResponse), but in the normal case the backend will send","displayNoNewLineWarning":false,"position":48,"left":383,"right":404},{"stylingDirective":null,"type":"DELETION","blobLineNumber":384,"text":"- some ParameterStatus messages, BackendKeyData, and finally ReadyForQuery.","html":"- some ParameterStatus messages, BackendKeyData, and finally ReadyForQuery.","displayNoNewLineWarning":false,"position":49,"left":384,"right":404},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":405,"text":"+ to fail (ErrorResponse) or the server to decline support for the requested","html":"+ to fail (ErrorResponse) or the server to decline support for the requested","displayNoNewLineWarning":false,"position":50,"left":384,"right":405},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":406,"text":"+ minor protocol version (NegotiateProtocolVersion), but in the normal case","html":"+ minor protocol version (NegotiateProtocolVersion), but in the normal case","displayNoNewLineWarning":false,"position":51,"left":384,"right":406},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":407,"text":"+ the backend will send some ParameterStatus messages, BackendKeyData, and","html":"+ the backend will send some ParameterStatus messages, BackendKeyData, and","displayNoNewLineWarning":false,"position":52,"left":384,"right":407},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":408,"text":"+ finally ReadyForQuery.","html":"+ finally ReadyForQuery.","displayNoNewLineWarning":false,"position":53,"left":384,"right":408},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":409,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":54,"left":385,"right":409},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":410,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":55,"left":386,"right":410},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":411,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":56,"left":387,"right":411},{"stylingDirective":null,"type":"HUNK","blobLineNumber":3944,"text":"@@ -3921,6 +3945,74 @@ FunctionCallResponse (B)","html":"@@ -3921,6 +3945,74 @@ FunctionCallResponse (B)","displayNoNewLineWarning":false,"position":57,"left":3920,"right":3944},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3945,"text":" \u003c/listitem\u003e","html":" \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":58,"left":3921,"right":3945},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3946,"text":" \u003c/varlistentry\u003e","html":" \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":59,"left":3922,"right":3946},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3947,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":60,"left":3923,"right":3947},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3948,"text":"+\u003cvarlistentry\u003e","html":"+\u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":61,"left":3923,"right":3948},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3949,"text":"+\u003cterm\u003e","html":"+\u0026lt;term\u0026gt;","displayNoNewLineWarning":false,"position":62,"left":3923,"right":3949},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3950,"text":"+NegotiateProtocolVersion (B)","html":"+NegotiateProtocolVersion (B)","displayNoNewLineWarning":false,"position":63,"left":3923,"right":3950},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3951,"text":"+\u003c/term\u003e","html":"+\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":64,"left":3923,"right":3951},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3952,"text":"+\u003clistitem\u003e","html":"+\u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":65,"left":3923,"right":3952},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3953,"text":"+\u003cpara\u003e","html":"+\u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":66,"left":3923,"right":3953},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3954,"text":"+","html":"+","displayNoNewLineWarning":false,"position":67,"left":3923,"right":3954},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3955,"text":"+\u003cvariablelist\u003e","html":"+\u0026lt;variablelist\u0026gt;","displayNoNewLineWarning":false,"position":68,"left":3923,"right":3955},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3956,"text":"+\u003cvarlistentry\u003e","html":"+\u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":69,"left":3923,"right":3956},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3957,"text":"+\u003cterm\u003e","html":"+\u0026lt;term\u0026gt;","displayNoNewLineWarning":false,"position":70,"left":3923,"right":3957},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3958,"text":"+ Byte1('v')","html":"+ Byte1(\u0026#39;v\u0026#39;)","displayNoNewLineWarning":false,"position":71,"left":3923,"right":3958},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3959,"text":"+\u003c/term\u003e","html":"+\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":72,"left":3923,"right":3959},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3960,"text":"+\u003clistitem\u003e","html":"+\u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":73,"left":3923,"right":3960},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3961,"text":"+\u003cpara\u003e","html":"+\u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":74,"left":3923,"right":3961},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3962,"text":"+ Identifies the message as a protocol version negotiation","html":"+ Identifies the message as a protocol version negotiation","displayNoNewLineWarning":false,"position":75,"left":3923,"right":3962},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3963,"text":"+ message.","html":"+ message.","displayNoNewLineWarning":false,"position":76,"left":3923,"right":3963},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3964,"text":"+\u003c/para\u003e","html":"+\u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":77,"left":3923,"right":3964},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3965,"text":"+\u003c/listitem\u003e","html":"+\u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":78,"left":3923,"right":3965},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3966,"text":"+\u003c/varlistentry\u003e","html":"+\u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":79,"left":3923,"right":3966},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3967,"text":"+\u003cvarlistentry\u003e","html":"+\u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":80,"left":3923,"right":3967},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3968,"text":"+\u003cterm\u003e","html":"+\u0026lt;term\u0026gt;","displayNoNewLineWarning":false,"position":81,"left":3923,"right":3968},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3969,"text":"+ Int32","html":"+ Int32","displayNoNewLineWarning":false,"position":82,"left":3923,"right":3969},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3970,"text":"+\u003c/term\u003e","html":"+\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":83,"left":3923,"right":3970},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3971,"text":"+\u003clistitem\u003e","html":"+\u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":84,"left":3923,"right":3971},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3972,"text":"+\u003cpara\u003e","html":"+\u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":85,"left":3923,"right":3972},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3973,"text":"+ Length of message contents in bytes, including self.","html":"+ Length of message contents in bytes, including self.","displayNoNewLineWarning":false,"position":86,"left":3923,"right":3973},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3974,"text":"+\u003c/para\u003e","html":"+\u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":87,"left":3923,"right":3974},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3975,"text":"+\u003c/listitem\u003e","html":"+\u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":88,"left":3923,"right":3975},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3976,"text":"+\u003c/varlistentry\u003e","html":"+\u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":89,"left":3923,"right":3976},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3977,"text":"+\u003cvarlistentry\u003e","html":"+\u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":90,"left":3923,"right":3977},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3978,"text":"+\u003cterm\u003e","html":"+\u0026lt;term\u0026gt;","displayNoNewLineWarning":false,"position":91,"left":3923,"right":3978},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3979,"text":"+ Int32","html":"+ Int32","displayNoNewLineWarning":false,"position":92,"left":3923,"right":3979},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3980,"text":"+\u003c/term\u003e","html":"+\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":93,"left":3923,"right":3980},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3981,"text":"+\u003clistitem\u003e","html":"+\u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":94,"left":3923,"right":3981},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3982,"text":"+\u003cpara\u003e","html":"+\u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":95,"left":3923,"right":3982},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3983,"text":"+ Newest minor protocol version supported by the server","html":"+ Newest minor protocol version supported by the server","displayNoNewLineWarning":false,"position":96,"left":3923,"right":3983},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3984,"text":"+ for the major protocol version requested by the client.","html":"+ for the major protocol version requested by the client.","displayNoNewLineWarning":false,"position":97,"left":3923,"right":3984},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3985,"text":"+\u003c/para\u003e","html":"+\u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":98,"left":3923,"right":3985},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3986,"text":"+\u003c/listitem\u003e","html":"+\u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":99,"left":3923,"right":3986},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3987,"text":"+\u003c/varlistentry\u003e","html":"+\u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":100,"left":3923,"right":3987},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3988,"text":"+\u003cvarlistentry\u003e","html":"+\u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":101,"left":3923,"right":3988},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3989,"text":"+\u003cterm\u003e","html":"+\u0026lt;term\u0026gt;","displayNoNewLineWarning":false,"position":102,"left":3923,"right":3989},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3990,"text":"+ Int32","html":"+ Int32","displayNoNewLineWarning":false,"position":103,"left":3923,"right":3990},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3991,"text":"+\u003c/term\u003e","html":"+\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":104,"left":3923,"right":3991},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3992,"text":"+\u003clistitem\u003e","html":"+\u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":105,"left":3923,"right":3992},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3993,"text":"+\u003cpara\u003e","html":"+\u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":106,"left":3923,"right":3993},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3994,"text":"+ Number of protocol options not recognized by the server.","html":"+ Number of protocol options not recognized by the server.","displayNoNewLineWarning":false,"position":107,"left":3923,"right":3994},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3995,"text":"+\u003c/para\u003e","html":"+\u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":108,"left":3923,"right":3995},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3996,"text":"+\u003c/listitem\u003e","html":"+\u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":109,"left":3923,"right":3996},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3997,"text":"+\u003c/varlistentry\u003e","html":"+\u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":110,"left":3923,"right":3997},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3998,"text":"+\u003c/variablelist\u003e","html":"+\u0026lt;/variablelist\u0026gt;","displayNoNewLineWarning":false,"position":111,"left":3923,"right":3998},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3999,"text":"+ Then, for protocol option not recognized by the server, there","html":"+ Then, for protocol option not recognized by the server, there","displayNoNewLineWarning":false,"position":112,"left":3923,"right":3999},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4000,"text":"+ is the following:","html":"+ is the following:","displayNoNewLineWarning":false,"position":113,"left":3923,"right":4000},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4001,"text":"+\u003cvariablelist\u003e","html":"+\u0026lt;variablelist\u0026gt;","displayNoNewLineWarning":false,"position":114,"left":3923,"right":4001},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4002,"text":"+\u003cvarlistentry\u003e","html":"+\u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":115,"left":3923,"right":4002},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4003,"text":"+\u003cterm\u003e","html":"+\u0026lt;term\u0026gt;","displayNoNewLineWarning":false,"position":116,"left":3923,"right":4003},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4004,"text":"+ String","html":"+ String","displayNoNewLineWarning":false,"position":117,"left":3923,"right":4004},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4005,"text":"+\u003c/term\u003e","html":"+\u0026lt;/term\u0026gt;","displayNoNewLineWarning":false,"position":118,"left":3923,"right":4005},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4006,"text":"+\u003clistitem\u003e","html":"+\u0026lt;listitem\u0026gt;","displayNoNewLineWarning":false,"position":119,"left":3923,"right":4006},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4007,"text":"+\u003cpara\u003e","html":"+\u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":120,"left":3923,"right":4007},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4008,"text":"+ The option name.","html":"+ The option name.","displayNoNewLineWarning":false,"position":121,"left":3923,"right":4008},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4009,"text":"+\u003c/para\u003e","html":"+\u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":122,"left":3923,"right":4009},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4010,"text":"+\u003c/listitem\u003e","html":"+\u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":123,"left":3923,"right":4010},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4011,"text":"+\u003c/varlistentry\u003e","html":"+\u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":124,"left":3923,"right":4011},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4012,"text":"+\u003c/variablelist\u003e","html":"+\u0026lt;/variablelist\u0026gt;","displayNoNewLineWarning":false,"position":125,"left":3923,"right":4012},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4013,"text":"+\u003c/para\u003e","html":"+\u0026lt;/para\u0026gt;"," 8000 displayNoNewLineWarning":false,"position":126,"left":3923,"right":4013},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4014,"text":"+\u003c/listitem\u003e","html":"+\u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":127,"left":3923,"right":4014},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4015,"text":"+\u003c/varlistentry\u003e","html":"+\u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":128,"left":3923,"right":4015},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4016,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":129,"left":3924,"right":4016},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4017,"text":" \u003cvarlistentry\u003e","html":" \u0026lt;varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":130,"left":3925,"right":4017},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4018,"text":" \u003cterm\u003e","html":" \u0026lt;term\u0026gt;","displayNoNewLineWarning":false,"position":131,"left":3926,"right":4018},{"stylingDirective":null,"type":"HUNK","blobLineNumber":4839,"text":"@@ -4748,11 +4840,13 @@ StartupMessage (F)","html":"@@ -4748,11 +4840,13 @@ StartupMessage (F)","displayNoNewLineWarning":false,"position":132,"left":4747,"right":4839},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4840,"text":" \u003c/varlistentry\u003e","html":" \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":133,"left":4748,"right":4840},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4841,"text":" \u003c/variablelist\u003e","html":" \u0026lt;/variablelist\u0026gt;","displayNoNewLineWarning":false,"position":134,"left":4749,"right":4841},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4842,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":135,"left":4750,"right":4842},{"stylingDirective":null,"type":"DELETION","blobLineNumber":4751,"text":"- In addition to the above, any run-time parameter that can be","html":"- In addition to the above, any run-time parameter that can be","displayNoNewLineWarning":false,"position":136,"left":4751,"right":4842},{"stylingDirective":null,"type":"DELETION","blobLineNumber":4752,"text":"- set at backend start time might be listed. Such settings","html":"- set at backend start time might be listed. Such settings","displayNoNewLineWarning":false,"position":137,"left":4752,"right":4842},{"stylingDirective":null,"type":"DELETION","blobLineNumber":4753,"text":"- will be applied during backend start (after parsing the","html":"- will be applied during backend start (after parsing the","displayNoNewLineWarning":false,"position":138,"left":4753,"right":4842},{"stylingDirective":null,"type":"DELETION","blobLineNumber":4754,"text":"- command-line arguments if any). The values will act as","html":"- command-line arguments if any). The values will act as","displayNoNewLineWarning":false,"position":139,"left":4754,"right":4842},{"stylingDirective":null,"type":"DELETION","blobLineNumber":4755,"text":"- session defaults.","html":"- session defaults.","displayNoNewLineWarning":false,"position":140,"left":4755,"right":4842},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4843,"text":"+ In addition to the above, others parameter may be listed.","html":"+ In addition to the above, others parameter may be listed.","displayNoNewLineWarning":false,"position":141,"left":4755,"right":4843},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4844,"text":"+ Parameter names beginning with \u003cliteral\u003e_pq_.\u003c/literal\u003e are","html":"+ Parameter names beginning with \u0026lt;literal\u0026gt;_pq_.\u0026lt;/literal\u0026gt; are","displayNoNewLineWarning":false,"position":142,"left":4755,"right":4844},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4845,"text":"+ reserved for use as protocol extensions, while others are","html":"+ reserved for use as protocol extensions, while others are","displayNoNewLineWarning":false,"position":143,"left":4755,"right":4845},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4846,"text":"+ treated as run-time parameters to be set at backend start","html":"+ treated as run-time parameters to be set at backend start","displayNoNewLineWarning":false,"position":144,"left":4755,"right":4846},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4847,"text":"+ time. Such settings will be applied during backend start","html":"+ time. Such settings will be applied during backend start","displayNoNewLineWarning":false,"position":145,"left":4755,"right":4847},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4848,"text":"+ (after parsing the command-line arguments if any) and will","html":"+ (after parsing the command-line arguments if any) and will","displayNoNewLineWarning":false,"position":146,"left":4755,"right":4848},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4849,"text":"+ act as session defaults.","html":"+ act as session defaults.","displayNoNewLineWarning":false,"position":147,"left":4755,"right":4849},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4850,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":148,"left":4756,"right":4850},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4851,"text":" \u003c/listitem\u003e","html":" \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":149,"left":4757,"right":4851},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":4852,"text":" \u003c/varlistentry\u003e","html":" \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":150,"left":4758,"right":4852}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":5307,"linesChanged":116,"newTreeEntry":{"lineCount":5307,"path":"doc/src/sgml/protocol.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/protocol.sgml","mode":100644},"linesAdded":105,"linesDeleted":11,"path":"doc/src/sgml/protocol.sgml","pathDigest":"331c33fd11c3ed85f9dbfead93f139c20ff3a25176651fc2ed37c486b97630e6","status":"MODIFIED","truncatedReason":null,"oldOid":"2cfafabe64bae2d7923ab9863786d7bcc7cdf793","newOid":"c703aa6258997d22ca7338bc221c31ff83feefb7","copilotChatReference":null,"deletedSha":"2cfafabe64bae2d7923ab9863786d7bcc7cdf793","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":98,"text":"@@ -99,6 +99,7 @@","html":"@@ -99,6 +99,7 @@","displayNoNewLineWarning":false,"position":0,"left":98,"right":98},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":99,"text":" #include \"libpq/auth.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;libpq/auth.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":99,"right":99},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":100,"text":" #include \"libpq/ip.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;libpq/ip.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":100,"right":100},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":101,"text":" #include \"libpq/libpq.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;libpq/libpq.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":3,"left":101,"right":101},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":102,"text":"+#include \"libpq/pqformat.h\"","html":"+\u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;libpq/pqformat.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":101,"right":102},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":103,"text":" #include \"libpq/pqsignal.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;libpq/pqsignal.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":102,"right":103},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":104,"text":" #include \"miscadmin.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;miscadmin.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":103,"right":104},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":105,"text":" #include \"pg_getopt.h\"","html":" \u003cspan class=pl-k\u003e#include\u003c/span\u003e \u003cspan class=pl-s\u003e\u0026quot;pg_getopt.h\u0026quot;\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":104,"right":105},{"stylingDirective":null,"type":"HUNK","blobLineNumber":398,"text":"@@ -398,6 +399,7 @@ static void ExitPostmaster(int status) pg_attribute_noreturn();","html":"@@ -398,6 +399,7 @@ static void ExitPostmaster(int status) pg_attribute_noreturn();","displayNoNewLineWarning":false,"position":8,"left":397,"right":398},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":399,"text":" static int\tServerLoop(void);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003eint\u003c/span\u003e\t\u003cspan class=pl-en\u003eServerLoop\u003c/span\u003e(\u003cspan class=pl-smi\u003evoid\u003c/span\u003e);","displayNoNewLineWarning":false,"position":9,"left":398,"right":399},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":400,"text":" static int\tBackendStartup(Port *port);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003eint\u003c/span\u003e\t\u003cspan class=pl-en\u003eBackendStartup\u003c/span\u003e(\u003cspan class=pl-smi\u003ePort\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eport\u003c/span\u003e);","displayNoNewLineWarning":false,"position":10,"left":399,"right":400},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":401,"text":" static int\tProcessStartupPacket(Port *port, bool SSLdone);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003eint\u003c/span\u003e\t\u003cspan class=pl-en\u003eProcessStartupPacket\u003c/span\u003e(\u003cspan class=pl-smi\u003ePort\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eport\u003c/span\u003e, \u003cspan class=pl-smi\u003ebool\u003c/span\u003e \u003cspan class=pl-s1\u003eSSLdone\u003c/span\u003e);","displayNoNewLineWarning":false,"position":11,"left":400,"right":401},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":402,"text":"+static void SendNegotiateProtocolVersion(List *unrecognized_protocol_options);","html":"+\u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003evoid\u003c/span\u003e \u003cspan class=pl-en\u003eSendNegotiateProtocolVersion\u003c/span\u003e(\u003cspan class=pl-smi\u003eList\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e);","displayNoNewLineWarning":false,"position":12,"left":400,"right":402},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":403,"text":" static void processCancelRequest(Port *port, void *pkt);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003evoid\u003c/span\u003e \u003cspan class=pl-en\u003eprocessCancelRequest\u003c/span\u003e(\u003cspan class=pl-smi\u003ePort\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eport\u003c/span\u003e, \u003cspan class=pl-smi\u003evoid\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003epkt\u003c/span\u003e);","displayNoNewLineWarning":false,"position":13,"left":401,"right":403},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":404,"text":" static int\tinitMasks(fd_set *rmask);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003eint\u003c/span\u003e\t\u003cspan class=pl-en\u003einitMasks\u003c/span\u003e(\u003cspan class=pl-smi\u003efd_set\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003ermask\u003c/span\u003e);","displayNoNewLineWarning":false,"position":14,"left":402,"right":404},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":405,"text":" static void report_fork_failure_to_client(Port *port, int errnum);","html":" \u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003evoid\u003c/span\u003e \u003cspan class=pl-en\u003ereport_fork_failure_to_client\u003c/span\u003e(\u003cspan class=pl-smi\u003ePort\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eport\u003c/span\u003e, \u003cspan class=pl-smi\u003eint\u003c/span\u003e \u003cspan class=pl-s1\u003eerrnum\u003c/span\u003e);","displayNoNewLineWarning":false,"position":15,"left":403,"right":405},{"stylingDirective":null,"type":"HUNK","blobLineNumber":2001,"text":"@@ -2000,12 +2002,9 @@ ProcessStartupPacket(Port *port, bool SSLdone)","html":"@@ -2000,12 +2002,9 @@ ProcessStartupPacket(Port *port, bool SSLdone)","displayNoNewLineWarning":false,"position":16,"left":1999,"right":2001},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2002,"text":" \t */","html":" \u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":2000,"right":2002},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2003,"text":" \tFrontendProtocol = proto;","html":" \t\u003cspan class=pl-s1\u003eFrontendProtocol\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eproto\u003c/span\u003e;","displayNoNewLineWarning":false,"position":18,"left":2001,"right":2003},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2004,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":19,"left":2002,"right":2004},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2003,"text":"-\t/* Check we can handle the protocol the frontend is using. */","html":"-\t\u003cspan class=pl-c\u003e/* Check we can handle the protocol the frontend is using. */\u003c/span\u003e","displayNoNewLineWarning":false,"position":20,"left":2003,"right":2004},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2004,"text":"-","html":"-","displayNoNewLineWarning":false,"position":21,"left":2004,"right":2004},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2005,"text":"+\t/* Check that the major protocol version is in range. */","html":"+\t\u003cspan class=pl-c\u003e/* Check that the major protocol version is in range. */\u003c/span\u003e","displayNoNewLineWarning":false,"position":22,"left":2004,"right":2005},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2006,"text":" \tif (PG_PROTOCOL_MAJOR(proto) \u003c PG_PROTOCOL_MAJOR(PG_PROTOCOL_EARLIEST) ||","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-s1\u003eproto\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026lt;\u003c/span\u003e \u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_PROTOCOL_EARLIEST\u003c/span\u003e) \u003cspan class=pl-c1\u003e||\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":2005,"right":2006},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2006,"text":"-\t\tPG_PROTOCOL_MAJOR(proto) \u003e PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) ||","html":"-\t\t\u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-s1\u003eproto\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026gt;\u003c/span\u003e \u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_PROTOCOL_LATEST\u003c/span\u003e) \u003cspan class=pl-c1\u003e||\u003c/span\u003e","displayNoNewLineWarning":false,"position":24,"left":2006,"right":2006},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2007,"text":"-\t\t(PG_PROTOCOL_MAJOR(proto) == PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) \u0026\u0026","html":"-\t\t(\u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-s1\u003eproto\u003c/span\u003e) \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_PROTOCOL_LATEST\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":2007,"right":2006},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2008,"text":"-\t\t PG_PROTOCOL_MINOR(proto) \u003e PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST)))","html":"-\t\t \u003cspan class=pl-en\u003ePG_PROTOCOL_MINOR\u003c/span\u003e(\u003cspan class=pl-s1\u003eproto\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026gt;\u003c/span\u003e \u003cspan class=pl-en\u003ePG_PROTOCOL_MINOR\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_PROTOCOL_LATEST\u003c/span\u003e)))","displayNoNewLineWarning":false,"position":26,"left":2008,"right":2006},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2007,"text":"+\t\tPG_PROTOCOL_MAJOR(proto) \u003e PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST))","html":"+\t\t\u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-s1\u003eproto\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026gt;\u003c/span\u003e \u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_PROTOCOL_LATEST\u003c/span\u003e))","displayNoNewLineWarning":false,"position":27,"left":2008,"right":2007},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2008,"text":" \t\tereport(FATAL,","html":" \t\t\u003cspan class=pl-en\u003eereport\u003c/span\u003e(\u003cspan class=pl-c1\u003eFATAL\u003c/span\u003e,","displayNoNewLineWarning":false,"position":28,"left":2009,"right":2008},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2009,"text":" \t\t\t\t(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),","html":" \t\t\t\t(\u003cspan class=pl-en\u003eerrcode\u003c/span\u003e(\u003cspan class=pl-c1\u003eERRCODE_FEATURE_NOT_SUPPORTED\u003c/span\u003e),","displayNoNewLineWarning":false,"position":29,"left":2010,"right":2009},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2010,"text":" \t\t\t\t errmsg(\"unsupported frontend protocol %u.%u: server supports %u.0 to %u.%u\",","html":" \t\t\t\t \u003cspan class=pl-en\u003eerrmsg\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;unsupported frontend protocol %u.%u: server supports %u.0 to %u.%u\u0026quot;\u003c/span\u003e,","displayNoNewLineWarning":false,"position":30,"left":2011,"right":2010},{"stylingDirective":null,"type":"HUNK","blobLineNumber":2025,"text":"@@ -2027,6 +2026,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)","html":"@@ -2027,6 +2026,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)","displayNoNewLineWarning":false,"position":31,"left":2026,"right":2025},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2026,"text":" \tif (PG_PROTOCOL_MAJOR(proto) \u003e= 3)","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003ePG_PROTOCOL_MAJOR\u003c/span\u003e(\u003cspan class=pl-s1\u003eproto\u003c/span\u003e) \u0026gt;= \u003cspan class=pl-c1\u003e3\u003c/span\u003e)","displayNoNewLineWarning":false,"position":32,"left":2027,"right":2026},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2027,"text":" \t{","html":" \t{","displayNoNewLineWarning":false,"position":33,"left":2028,"right":2027},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2028,"text":" \t\tint32\t\toffset = sizeof(ProtocolVersion);","html":" \t\t\u003cspan class=pl-smi\u003eint32\u003c/span\u003e\t\t\u003cspan class=pl-s1\u003eoffset\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-k\u003esizeof\u003c/span\u003e(\u003cspan class=pl-s1\u003eProtocolVersion\u003c/span\u003e);","displayNoNewLineWarning":false,"position":34,"left":2029,"right":2028},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2029,"text":"+\t\tList\t *unrecognized_protocol_options = NIL;","html":"+\t\t\u003cspan class=pl-smi\u003eList\u003c/span\u003e\t \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":35,"left":2029,"right":2029},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2030,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":36,"left":2030,"right":2030},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2031,"text":" \t\t/*","html":" \t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":37,"left":2031,"right":2031},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2032,"text":" \t\t * Scan packet body for name/option pairs. We can assume any string","html":" \u003cspan class=pl-c\u003e\t\t * Scan packet body for name/option pairs. We can assume any string\u003c/span\u003e","displayNoNewLineWarning":false,"position":38,"left":2032,"right":2032},{"stylingDirective":null,"type":"HUNK","blobLineNumber":2075,"text":"@@ -2076,6 +2076,16 @@ ProcessStartupPacket(Port *port, bool SSLdone)","html":"@@ -2076,6 +2076,16 @@ ProcessStartupPacket(Port *port, bool SSLdone)","displayNoNewLineWarning":false,"position":39,"left":2075,"right":2075},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2076,"text":" \t\t\t\t\t\t\t\t\tvalptr),","html":" \t\t\t\t\t\t\t\t\t\u003cspan class=pl-s1\u003evalptr\u003c/span\u003e),","displayNoNewLineWarning":false,"position":40,"left":2076,"right":2076},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2077,"text":" \t\t\t\t\t\t\t errhint(\"Valid values are: \\\"false\\\", 0, \\\"true\\\", 1, \\\"database\\\".\")));","html":" \t\t\t\t\t\t\t \u003cspan class=pl-en\u003eerrhint\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;Valid values are: \\\u0026quot;false\\\u0026quot;, 0, \\\u0026quot;true\\\u0026quot;, 1, \\\u0026quot;database\\\u0026quot;.\u0026quot;\u003c/span\u003e)));","displayNoNewLineWarning":false,"position":41,"left":2077,"right":2077},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2078,"text":" \t\t\t}","html":" \t\t\t}","displayNoNewLineWarning":false,"position":42,"left":2078,"right":2078},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2079,"text":"+\t\t\telse if (strncmp(nameptr, \"_pq_.\", 5) == 0)","html":"+\t\t\t\u003cspan class=pl-k\u003eelse\u003c/span\u003e \u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003estrncmp\u003c/span\u003e(\u003cspan class=pl-s1\u003enameptr\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;_pq_.\u0026quot;\u003c/span\u003e, \u003cspan class=pl-c1\u003e5\u003c/span\u003e) \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e)","displayNoNewLineWarning":false,"position":43,"left":2078,"right":2079},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2080,"text":"+\t\t\t{","html":"+\t\t\t{","displayNoNewLineWarning":false,"position":44,"left":2078,"right":2080},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2081,"text":"+\t\t\t\t/*","html":"+\t\t\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":45,"left":2078,"right":2081},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2082,"text":"+\t\t\t\t * Any option beginning with _pq_. is reserved for use as a","html":"+\u003cspan class=pl-c\u003e\t\t\t\t * Any option beginning with _pq_. is reserved for use as a\u003c/span\u003e","displayNoNewLineWarning":false,"position":46,"left":2078,"right":2082},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2083,"text":"+\t\t\t\t * protocol-level option, but at present no such options are","html":"+\u003cspan class=pl-c\u003e\t\t\t\t * protocol-level option, but at present no such options are\u003c/span\u003e","displayNoNewLineWarning":false,"position":47,"left":2078,"right":2083},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2084,"text":"+\t\t\t\t * defined.","html":"+\u003cspan class=pl-c\u003e\t\t\t\t * defined.\u003c/span\u003e","displayNoNewLineWarning":false,"position":48,"left":2078,"right":2084},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2085,"text":"+\t\t\t\t */","html":"+\u003cspan class=pl-c\u003e\t\t\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":49,"left":2078,"right":2085},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2086,"text":"+\t\t\t\tunrecognized_protocol_options =","html":"+\t\t\t\t\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e","displayNoNewLineWarning":false,"position":50,"left":2078,"right":2086},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2087,"text":"+\t\t\t\t\tlappend(unrecognized_protocol_options, pstrdup(nameptr));","html":"+\t\t\t\t\t\u003cspan class=pl-en\u003elappend\u003c/span\u003e(\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e, \u003cspan class=pl-en\u003epstrdup\u003c/span\u003e(\u003cspan class=pl-s1\u003enameptr\u003c/span\u003e));","displayNoNewLineWarning":false,"position":51,"left":2078,"right":2087},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2088,"text":"+\t\t\t}","html":"+\t\t\t}","displayNoNewLineWarning":false,"position":52,"left":2078,"right":2088},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2089,"text":" \t\t\telse","html":" \t\t\t\u003cspan class=pl-k\u003eelse\u003c/span\u003e","displayNoNewLineWarning":false,"position":53,"left":2079,"right":2089},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2090,"text":" \t\t\t{","html":" \t\t\t{","displayNoNewLineWarning":false,"position":54,"left":2080,"right":2090},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2091,"text":" \t\t\t\t/* Assume it's a generic GUC option */","html":" \t\t\t\t\u003cspan class=pl-c\u003e/* Assume it\u0026#39;s a generic GUC option */\u003c/span\u003e","displayNoNewLineWarning":false,"position":55,"left":2081,"right":2091},{"stylingDirective":null,"type":"HUNK","blobLineNumber":2104,"text":"@@ -2095,6 +2105,16 @@ ProcessStartupPacket(Port *port, bool SSLdone)","html":"@@ -2095,6 +2105,16 @@ ProcessStartupPacket(Port *port, bool SSLdone)","displayNoNewLineWarning":false,"position":56,"left":2094,"right":2104},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2105,"text":" \t\t\tereport(FATAL,","html":" \t\t\t\u003cspan class=pl-en\u003eereport\u003c/span\u003e(\u003cspan class=pl-c1\u003eFATAL\u003c/span\u003e,","displayNoNewLineWarning":false,"position":57,"left":2095,"right":2105},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2106,"text":" \t\t\t\t\t(errcode(ERRCODE_PROTOCOL_VIOLATION),","html":" \t\t\t\t\t(\u003cspan class=pl-en\u003eerrcode\u003c/span\u003e(\u003cspan class=pl-c1\u003eERRCODE_PROTOCOL_VIOLATION\u003c/span\u003e),","displayNoNewLineWarning":false,"position":58,"left":2096,"right":2106},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2107,"text":" \t\t\t\t\t errmsg(\"invalid startup packet layout: expected terminator as last byte\")));","html":" \t\t\t\t\t \u003cspan class=pl-en\u003eerrmsg\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;invalid startup packet layout: expected terminator as last byte\u0026quot;\u003c/span\u003e)));","displayNoNewLineWarning":false,"position":59,"left":2097,"right":2107},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2108,"text":"+","html":"+","displayNoNewLineWarning":false,"position":60,"left":2097,"right":2108},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2109,"text":"+\t\t/*","html":"+\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":61,"left":2097,"right":2109},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2110,"text":"+\t\t * If the client requested a newer protocol version or if the client","html":"+\u003cspan class=pl-c\u003e\t\t * If the client requested a newer protocol version or if the client\u003c/span\u003e","displayNoNewLineWarning":false,"position":62,"left":2097,"right":2110},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2111,"text":"+\t\t * requested any protocol options we didn't recognize, let them know","html":"+\u003cspan class=pl-c\u003e\t\t * requested any protocol options we didn\u0026#39;t recognize, let them know\u003c/span\u003e","displayNoNewLineWarning":false,"position":63,"left":2097,"right":2111},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2112,"text":"+\t\t * the newest minor protocol version we do support and the names of any","html":"+\u003cspan class=pl-c\u003e\t\t * the newest minor protocol version we do support and the names of any\u003c/span\u003e","displayNoNewLineWarning":false,"position":64,"left":2097,"right":2112},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2113,"text":"+\t\t * unrecognized options.","html":"+\u003cspan class=pl-c\u003e\t\t * unrecognized options.\u003c/span\u003e","displayNoNewLineWarning":false,"position":65,"left":2097,"right":2113},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2114,"text":"+\t\t */","html":"+\u003cspan class=pl-c\u003e\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":66,"left":2097,"right":2114},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2115,"text":"+\t\tif (PG_PROTOCOL_MINOR(proto) \u003e PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST) ||","html":"+\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003ePG_PROTOCOL_MINOR\u003c/span\u003e(\u003cspan class=pl-s1\u003eproto\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026gt;\u003c/span\u003e \u003cspan class=pl-en\u003ePG_PROTOCOL_MINOR\u003c/span\u003e(\u003cspan class=pl-c1\u003ePG_PROTOCOL_LATEST\u003c/span\u003e) \u003cspan class=pl-c1\u003e||\u003c/span\u003e","displayNoNewLineWarning":false,"position":67,"left":2097,"right":2115},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2116,"text":"+\t\t\tunrecognized_protocol_options != NIL)","html":"+\t\t\t\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e)","displayNoNewLineWarning":false,"position":68,"left":2097,"right":2116},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2117,"text":"+\t\t\tSendNegotiateProtocolVersion(unrecognized_protocol_options);","html":"+\t\t\t\u003cspan class=pl-en\u003eSendNegotiateProtocolVersion\u003c/span\u003e(\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e);","displayNoNewLineWarning":false,"position":69,"left":2097,"right":2117},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2118,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":70,"left":2098,"right":2118},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2119,"text":" \telse","html":" \t\u003cspan class=pl-k\u003eelse\u003c/span\u003e","displayNoNewLineWarning":false,"position":71,"left":2099,"right":2119},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2120,"text":" \t{","html":" \t{","displayNoNewLineWarning":false,"position":72,"left":2100,"right":2120},{"stylingDirective":null,"type":"HUNK","blobLineNumber":2227,"text":"@@ -2208,6 +2228,34 @@ ProcessStartupPacket(Port *port, bool SSLdone)","html":"@@ -2208,6 +2228,34 @@ ProcessStartupPacket(Port *port, bool SSLdone)","displayNoNewLineWarning":false,"position":73,"left":2207,"right":2227},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2228,"text":" \treturn STATUS_OK;","html":" \t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e \u003cspan class=pl-c1\u003eSTATUS_OK\u003c/span\u003e;","displayNoNewLineWarn 8000 ing":false,"position":74,"left":2208,"right":2228},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2229,"text":" }","html":" }","displayNoNewLineWarning":false,"position":75,"left":2209,"right":2229},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2230,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":76,"left":2210,"right":2230},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2231,"text":"+/*","html":"+\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":77,"left":2210,"right":2231},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2232,"text":"+ * Send a NegotiateProtocolVersion to the client. This lets the client know","html":"+\u003cspan class=pl-c\u003e * Send a NegotiateProtocolVersion to the client. This lets the client know\u003c/span\u003e","displayNoNewLineWarning":false,"position":78,"left":2210,"right":2232},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2233,"text":"+ * that they have requested a newer minor protocol version than we are able","html":"+\u003cspan class=pl-c\u003e * that they have requested a newer minor protocol version than we are able\u003c/span\u003e","displayNoNewLineWarning":false,"position":79,"left":2210,"right":2233},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2234,"text":"+ * to speak. We'll speak the highest version we know about; the client can,","html":"+\u003cspan class=pl-c\u003e * to speak. We\u0026#39;ll speak the highest version we know about; the client can,\u003c/span\u003e","displayNoNewLineWarning":false,"position":80,"left":2210,"right":2234},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2235,"text":"+ * of course, abandon the connection if that's a problem.","html":"+\u003cspan class=pl-c\u003e * of course, abandon the connection if that\u0026#39;s a problem.\u003c/span\u003e","displayNoNewLineWarning":false,"position":81,"left":2210,"right":2235},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2236,"text":"+ *","html":"+\u003cspan class=pl-c\u003e *\u003c/span\u003e","displayNoNewLineWarning":false,"position":82,"left":2210,"right":2236},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2237,"text":"+ * We also include in the response a list of protocol options we didn't","html":"+\u003cspan class=pl-c\u003e * We also include in the response a list of protocol options we didn\u0026#39;t\u003c/span\u003e","displayNoNewLineWarning":false,"position":83,"left":2210,"right":2237},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2238,"text":"+ * understand. This allows clients to include optional parameters that might","html":"+\u003cspan class=pl-c\u003e * understand. This allows clients to include optional parameters that might\u003c/span\u003e","displayNoNewLineWarning":false,"position":84,"left":2210,"right":2238},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2239,"text":"+ * be present either in newer protocol versions or third-party protocol","html":"+\u003cspan class=pl-c\u003e * be present either in newer protocol versions or third-party protocol\u003c/span\u003e","displayNoNewLineWarning":false,"position":85,"left":2210,"right":2239},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2240,"text":"+ * extensions without fear of having to reconnect if those options are not","html":"+\u003cspan class=pl-c\u003e * extensions without fear of having to reconnect if those options are not\u003c/span\u003e","displayNoNewLineWarning":false,"position":86,"left":2210,"right":2240},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2241,"text":"+ * understood, while at the same time making certain that the client is aware","html":"+\u003cspan class=pl-c\u003e * understood, while at the same time making certain that the client is aware\u003c/span\u003e","displayNoNewLineWarning":false,"position":87,"left":2210,"right":2241},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2242,"text":"+ * of which options were actually accepted.","html":"+\u003cspan class=pl-c\u003e * of which options were actually accepted.\u003c/span\u003e","displayNoNewLineWarning":false,"position":88,"left":2210,"right":2242},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2243,"text":"+ */","html":"+\u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":89,"left":2210,"right":2243},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2244,"text":"+static void","html":"+\u003cspan class=pl-k\u003estatic\u003c/span\u003e \u003cspan class=pl-smi\u003evoid\u003c/span\u003e","displayNoNewLineWarning":false,"position":90,"left":2210,"right":2244},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2245,"text":"+SendNegotiateProtocolVersion(List *unrecognized_protocol_options)","html":"+\u003cspan class=pl-en\u003eSendNegotiateProtocolVersion\u003c/span\u003e(\u003cspan class=pl-smi\u003eList\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e)","displayNoNewLineWarning":false,"position":91,"left":2210,"right":2245},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2246,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":92,"left":2210,"right":2246},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2247,"text":"+\tStringInfoData buf;","html":"+\t\u003cspan class=pl-smi\u003eStringInfoData\u003c/span\u003e \u003cspan class=pl-s1\u003ebuf\u003c/span\u003e;","displayNoNewLineWarning":false,"position":93,"left":2210,"right":2247},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2248,"text":"+\tListCell *lc;","html":"+\t\u003cspan class=pl-smi\u003eListCell\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003elc\u003c/span\u003e;","displayNoNewLineWarning":false,"position":94,"left":2210,"right":2248},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2249,"text":"+","html":"+","displayNoNewLineWarning":false,"position":95,"left":2210,"right":2249},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2250,"text":"+\tpq_beginmessage(\u0026buf, 'v'); /* NegotiateProtocolVersion */","html":"+\t\u003cspan class=pl-en\u003epq_beginmessage\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e, \u003cspan class=pl-c1\u003e\u0026#39;v\u0026#39;\u003c/span\u003e); \u003cspan class=pl-c\u003e/* NegotiateProtocolVersion */\u003c/span\u003e","displayNoNewLineWarning":false,"position":96,"left":2210,"right":2250},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2251,"text":"+\tpq_sendint(\u0026buf, PG_PROTOCOL_LATEST, 4);","html":"+\t\u003cspan class=pl-en\u003epq_sendint\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e, \u003cspan class=pl-c1\u003ePG_PROTOCOL_LATEST\u003c/span\u003e, \u003cspan class=pl-c1\u003e4\u003c/span\u003e);","displayNoNewLineWarning":false,"position":97,"left":2210,"right":2251},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2252,"text":"+\tpq_sendint(\u0026buf, list_length(unrecognized_protocol_options), 4);","html":"+\t\u003cspan class=pl-en\u003epq_sendint\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e, \u003cspan class=pl-en\u003elist_length\u003c/span\u003e(\u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e), \u003cspan class=pl-c1\u003e4\u003c/span\u003e);","displayNoNewLineWarning":false,"position":98,"left":2210,"right":2252},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2253,"text":"+\tforeach(lc, unrecognized_protocol_options)","html":"+\t\u003cspan class=pl-en\u003eforeach\u003c/span\u003e(\u003cspan class=pl-s1\u003elc\u003c/span\u003e, \u003cspan class=pl-s1\u003eunrecognized_protocol_options\u003c/span\u003e)","displayNoNewLineWarning":false,"position":99,"left":2210,"right":2253},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2254,"text":"+\t\tpq_sendstring(\u0026buf, lfirst(lc));","html":"+\t\t\u003cspan class=pl-en\u003epq_sendstring\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e, \u003cspan class=pl-en\u003elfirst\u003c/span\u003e(\u003cspan class=pl-s1\u003elc\u003c/span\u003e));","displayNoNewLineWarning":false,"position":100,"left":2210,"right":2254},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2255,"text":"+\tpq_endmessage(\u0026buf);","html":"+\t\u003cspan class=pl-en\u003epq_endmessage\u003c/span\u003e(\u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003ebuf\u003c/span\u003e);","displayNoNewLineWarning":false,"position":101,"left":2210,"right":2255},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2256,"text":"+","html":"+","displayNoNewLineWarning":false,"position":102,"left":2210,"right":2256},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2257,"text":"+\t/* no need to flush, some other message will follow */","html":"+\t\u003cspan class=pl-c\u003e/* no need to flush, some other message will follow */\u003c/span\u003e","displayNoNewLineWarning":false,"position":103,"left":2210,"right":2257},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2258,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":104,"left":2210,"right":2258},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2259,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":105,"left":2211,"right":2259},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2260,"text":" /*","html":" \u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":106,"left":2212,"right":2260},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2261,"text":" * The client has sent a cancel request packet, not a normal","html":" \u003cspan class=pl-c\u003e * The client has sent a cancel request packet, not a normal\u003c/span\u003e","displayNoNewLineWarning":false,"position":107,"left":2213,"right":2261}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":6333,"linesChanged":58,"newTreeEntry":{"lineCount":6333,"path":"src/backend/postmaster/postmaster.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/postmaster/postmaster.c","mode":100644},"linesAdded":53,"linesDeleted":5,"path":"src/backend/postmaster/postmaster.c","pathDigest":"f645f6cb33adf635a60fbaba0e095b75112ddd0b14468c14058e96bbbd33a58a","status":"MODIFIED","truncatedReason":null,"oldOid":"2cfafabe64bae2d7923ab9863786d7bcc7cdf793","newOid":"c703aa6258997d22ca7338bc221c31ff83feefb7","copilotChatReference":null,"deletedSha":"2cfafabe64bae2d7923ab9863786d7bcc7cdf793","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/koderP/postgres/commit/c703aa6258997d22ca7338bc221c31ff83feefb7","fileTreeExpanded":true,"headerInfo":{"additions":158,"deletions":16,"filesChanged":2,"filesChangedString":"2"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":2,"truncated":false,"byteCount":9355,"lineShownCount":259},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"zTGNsB5YWf1FafXo-Z7R0RDrwoae5GFBC3-u5eyI3wLTu9LW_y9pajkuFHlbsjgNCltV1vVaFyqjNWAt3G-xcQ"},"/users/diffview?diff=unified":{"post":"edHb6sbaBfBx-uObFaSPevAz5nsOAMY1q_cNyvMRrSFnW4SMJ601Zw29Agq3iGam6oNxK2W-sF4DvcMCw_bDUg"},"/notifications/thread":{"post":"LR3sAzEhkWCvk9KkZsP65YsEZSxkZMwn-_QHbUfAFBFajZViFud0zSCuh4CDdOFrVZgvOmXlhTOcDL92eIkibg"}}},"title":"Provide for forward compatibility with future minor protocol versions. · koderP/postgres@c703aa6","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-6dcb06aa9fad.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":false,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false}}}

Commit c703aa6

Browse files
committed
Provide for forward compatibility with future minor protocol versions.
Previously, any attempt to request a 3.x protocol version other than 3.0 would lead to a hard connection failure, which made the minor protocol version really no different from the major protocol version and precluded gentle protocol version breaks. Instead, when the client requests a 3.x protocol version where x is greater than 0, send the new NegotiateProtocolVersion message to convey that we support only 3.0. This makes it possible to introduce new minor protocol versions without requiring a connection retry when the server is older. In addition, if the startup packet includes name/value pairs where the name starts with "_pq_.", assume that those are protocol options, not GUCs. Include those we don't support (i.e. all of them, at present) in the NegotiateProtocolVersion message so that the client knows they were not understood. This makes it possible for the client to request previously-unsupported features without bumping the protocol version at all; the client can tell from the server's response whether the option was understood. It will take some time before servers that support these new facilities become common in the wild; to speed things up and make things easier for a future 3.1 protocol version, back-patch to all supported releases. Robert Haas and Badrul Chowdhury Discussion: http://postgr.es/m/BN6PR21MB0772FFA0CBD298B76017744CD1730@BN6PR21MB0772.namprd21.prod.outlook.com Discussion: 8000 http://postgr.es/m/30788.1498672033@sss.pgh.pa.us
1 parent 2cfafab commit c703aa6

File tree

2 files changed

+158
-16
lines changed

2 files changed

+158
-16
lines changed

doc/src/sgml/protocol.sgml

Lines changed: 105 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@
2222
<productname>PostgreSQL</productname> 7.4 and later. For descriptions
2323
of the earlier protocol versions, see previous releases of the
2424
<productname>PostgreSQL</productname> documentation. A single server
25-
can support multiple protocol versions. The initial
26-
startup-request message tells the server which protocol version the
27-
client is attempting to use, and then the server follows that protocol
28-
if it is able.
25+
can support multiple protocol versions. The initial startup-request
26+
message tells the server which protocol version the client is attempting to
27+
use. If the major version requested by the client is not supported by
28+
the server, the connection will be rejected (for example, this would occur
29+
if the client requested protocol version 4.0, which does not exist as of
30+
this writing). If the minor version requested by the client is not
31+
supported by the server (e.g. the client requests version 3.1, but the
32+
server supports only 3.0), the server may either reject the connection or
33+
may respond with a NegotiateProtocolVersion message containing the highest
34+
minor protocol version which it supports. The client may then choose either
35+
to continue with the connection using the specified protocol version or
36+
to abort the connection.
2937
</para>
3038

3139
<para>
@@ -366,6 +374,20 @@
366374
</listitem>
367375
</varlistentry>
368376

377+
<varlistentry>
378+
<term>NegotiateProtocolVersion</term>
379+
<listitem>
380+
<para>
381+
The server does not support the minor protocol version requested
382+
by the client, but does support an earlier version of the protocol;
383+
this message indicates the highest supported minor version. This
384+
message will also be sent if the client requested unsupported protocol
385+
options (i.e. beginning with <literal>_pq_.</literal>) in the
386+
startup packet. This message will be followed by an ErrorResponse or
387+
a message indicating the success 8000 or failure of authentication.
388+
</para>
389+
</listitem>
390+
</varlistentry>
369391
</variablelist>
370392
</para>
371393

@@ -380,8 +402,10 @@
380402
for further messages from the server. In this phase a backend process
381403
is being started, and the frontend is just an interested bystander.
382404
It is still possible for the startup attempt
383-
to fail (ErrorResponse), but in the normal case the backend will send
384-
some ParameterStatus messages, BackendKeyData, and finally ReadyForQuery.
405+
to fail (ErrorResponse) or the server to decline support for the requested
406+
minor protocol version (NegotiateProtocolVersion), but in the normal case
407+
the backend will send some ParameterStatus messages, BackendKeyData, and
408+
finally ReadyForQuery.
385409
</para>
386410

387411
<para>
@@ -3921,6 +3945,74 @@ FunctionCallResponse (B)
39213945
</listitem>
39223946
</varlistentry>
39233947

3948+
<varlistentry>
3949+
<term>
3950+
NegotiateProtocolVersion (B)
3951+
</term>
3952+
<listitem>
3953+
<para>
3954+
3955+
<variablelist>
3956+
<varlistentry>
3957+
<term>
3958+
Byte1('v')
3959+
</term>
3960+
<listitem>
3961+
<para>
3962+
Identifies the message as a protocol version negotiation
3963+
message.
3964+
</para>
3965+
</listitem>
3966+
</varlistentry>
3967+
<varlistentry>
3968+
<term>
3969+
Int32
3970+
</term>
3971+
<listitem>
3972+
<para>
3973+
Length of message contents in bytes, including self.
3974+
</para>
3975+
</listitem>
3976+
</varlistentry>
3977+
<varlistentry>
3978+
<term>
3979+
Int32
3980+
</term>
3981+
<listitem>
3982+
<para>
3983+
Newest minor protocol version supported by the server
3984+
for the major protocol version requested by the client.
3985+
</para>
3986+
</listitem>
3987+
</varlistentry>
3988+
<varlistentry>
3989+
<term>
3990+
Int32
3991+
</term>
3992+
<listitem>
3993+
<para>
3994+
Number of protocol options not recognized by the server.
3995+
</para>
3996+
</listitem>
3997+
</varlistentry>
3998+
</variablelist>
3999+
Then, for protocol option not recognized by the server, there
4000+
is the following:
4001+
<variablelist>
4002+
<varlistentry>
4003+
<term>
4004+
String
4005+
</term>
4006+
<listitem>
4007+
<para>
4008+
The option name.
4009+
</para>
4010+
</listitem>
4011+
</varlistentry>
4012+
</variablelist>
4013+
</para>
4014+
</listitem>
4015+
</varlistentry>
39244016

39254017
<varlistentry>
39264018
<term>
@@ -4748,11 +4840,13 @@ StartupMessage (F)
47484840
</varlistentry>
47494841
</variablelist>
47504842

4751-
In addition to the above, any run-time parameter that can be
4752-
set at backend start time might be listed. Such settings
4753-
will be applied during backend start (after parsing the
4754-
command-line arguments if any). The values will act as
4755-
session defaults.
4843+
In addition to the above, others parameter may be listed.
4844+
Parameter names beginning with <literal>_pq_.</literal> are
4845+
reserved for use as protocol extensions, while others are
4846+
treated as run-time parameters to be set at backend start
4847+
time. Such settings will be applied during backend start
4848+
(after parsing the command-line arguments if any) and will
4849+
act as session defaults.
47564850
</para>
47574851
</listitem>
47584852
</varlistentry>

src/backend/postmaster/postmaster.c

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
#include "libpq/auth.h"
100100
#include "libpq/ip.h"
101101
#include "libpq/libpq.h"
102+
#include "libpq/pqformat.h"
102103
#include "libpq/pqsignal.h"
103104
#include "miscadmin.h"
104105
#include "pg_getopt.h"
@@ -398,6 +399,7 @@ static void ExitPostmaster(int status) pg_attribute_noreturn();
398399
static int ServerLoop(void);
399400
static int BackendStartup(Port *port);
400401
static int ProcessStartupPacket(Port *port, bool SSLdone);
402+
static void SendNegotiateProtocolVersion(List *unrecognized_protocol_options);
401403
static void processCancelRequest(Port *port, void *pkt);
402404
static int initMasks(fd_set *rmask);
403405
static void report_fork_failure_to_client(Port *port, int errnum);
@@ -2000,12 +2002,9 @@ ProcessStartupPacket(Port *port, bool SSLdone)
20002002
*/
20012003
FrontendProtocol = proto;
20022004

2003-
/* Check we can handle the protocol the frontend is using. */
2004-
2005+
/* Check that the major protocol version is in range. */
20052006
if (PG_PROTOCOL_MAJOR(proto) < PG_PROTOCOL_MAJOR(PG_PROTOCOL_EARLIEST) ||
2006-
PG_PROTOCOL_MAJOR(proto) > PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) ||
2007-
(PG_PROTOCOL_MAJOR(proto) == PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) &&
2008-
PG_PROTOCOL_MINOR(proto) > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST)))
2007+
PG_PROTOCOL_MAJOR(proto) > PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST))
20092008
ereport(FATAL,
20102009
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
20112010
errmsg("unsupported frontend protocol %u.%u: server supports %u.0 to %u.%u",
@@ -2027,6 +2026,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
20272026
if (PG_PROTOCOL_MAJOR(proto) >= 3)
20282027
{
20292028
int32 offset = sizeof(ProtocolVersion);
2029+
List *unrecognized_protocol_options = NIL;
20302030

20312031
/*
20322032
* Scan packet body for name/option pairs. We can assume any string
@@ -2076,6 +2076,16 @@ ProcessStartupPacket(Port *port, bool SSLdone)
20762076
valptr),
20772077
errhint("Valid values are: \"false\", 0, \"true\", 1, \"database\".")));
20782078
}
2079+
else if (strncmp(nameptr, "_pq_.", 5) == 0)
2080+
{
2081+
/*
2082+
* Any option beginning with _pq_. is reserved for use as a
2083+
* protocol-level option, but at present no such options are
2084+
* defined.
2085+
*/
2086+
unrecognized_protocol_options =
2087+
lappend(unrecognized_protocol_options, pstrdup(nameptr));
2088+
}
20792089
else
20802090
{
20812091
/* Assume it's a generic GUC option */
@@ -2095,6 +2105,16 @@ ProcessStartupPacket(Port *port, bool SSLdone)
20952105
ereport(FATAL,
20962106
(errcode(ERRCODE_PROTOCOL_VIOLATION),
20972107
errmsg("invalid startup packet layout: expected terminator as last byte")));
2108+
2109+
/*
2110+
* If the client requested a newer protocol version or if the client
2111+
* requested any protocol options we didn't recognize, let them know
2112+
* the newest minor protocol version we do support and the names of any
2113+
* unrecognized options.
2114+
*/
2115+
if (PG_PROTOCOL_MINOR(proto) > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST) ||
2116+
unrecognized_protocol_options != NIL)
2117+
SendNegotiateProtocolVersion(unrecognized_protocol_options);
20982118
}
20992119
else
21002120
{
@@ -2208,6 +2228,34 @@ ProcessStartupPacket(Port *port, bool SSLdone)
22082228
return STATUS_OK;
22092229
}
22102230

2231+
/*
2232+
* Send a NegotiateProtocolVersion to the client. This lets the client know
2233+
* that they have requested a newer minor protocol version than we are able
2234+
* to speak. We'll speak the highest version we know about; the client can,
2235+
* of course, abandon the connection if that's a problem.
2236+
*
2237+
* We also include in the response a list of protocol options we didn't
2238+
* understand. This allows clients to include optional parameters that might
2239+
* be present either in newer protocol versions or third-party protocol
2240+
* extensions without fear of having to reconnect if those options are not
2241+
* understood, while at the same time making certain that the client is aware
2242+
* of which options were actually accepted.
2243+
*/
2244+
static void
2245+
SendNegotiateProtocolVersion(List *unrecognized_protocol_options)
2246+
{
2247+
StringInfoData buf;
2248+
ListCell *lc;
2249+
2250+
pq_beginmessage(&buf, 'v'); /* NegotiateProtocolVersion */
2251+
pq_sendint(&buf, PG_PROTOCOL_LATEST, 4);
2252+
pq_sendint(&buf, list_length(unrecognized_protocol_options), 4);
2253+
foreach(lc, unrecognized_protocol_options)
2254+
pq_sendstring(&buf, lfirst(lc));
2255+
pq_endmessage(&buf);
2256+
2257+
/* no need to flush, some other message will follow */
2258+
}
22112259

22122260
/*
22132261
* The client has sent a cancel request packet, not a normal

0 commit comments

Comments
 (0)
0